n = []
for i in 1..149 do
  for j in 2..150 do
    if i < j
      n << ["#{i} #{j}", i*i + j*j]
    else
    end
  end
end
num_h = 1
num_w = 2
while !(num_h == num_w) do
  m = []
  num_s = gets.chomp
  s = num_s.split(" ")
  num_h = s[0].to_i
  num_w = s[1].to_i
  c = num_h * num_h + num_w * num_w
  for k in 0..n.length-1 do
    if n[k][1] > c
      m << n[k]
    elsif n[k][1] == c
      if !((num_h == n[k][0].split(" ")[0].to_i) && (num_w == n[k][0].split(" ")[1].to_i))
        m << n[k]
      else
      end
    else
    end
    l = []
    m.each do |u|
    l << u[1]
    end
  end
  r = l.min
  puts m.rassoc(r)[0]
end