dict = [*1..150].combination(2).map{|h,w| [h**2+w**2, h, w]}.sort
loop do
  h, w = gets.split.map(&:to_i)
  break if h==0

  r = dict[dict.index{|x| x[1] == h && x[2] ==w}+1]
  puts [r[1],r[2]].join(' ')
end