program parket;
var c, s, x, y : longint;

begin
    readln(c, s);
    x := trunc(sqrt(c+s));
    y := x;
    repeat
        if (x-2)*(y-2) > s then
            dec(y)
        else if (x-2)*(y-2) < s then
            inc(x);
    until c = 2*(x+y-2);
    writeln(x, ' ', y);
end.
