def compare(hw1, hw2)
  d1 = hw1[0]**2 + hw1[1]**2
  d2 = hw2[0]**2 + hw2[1]**2
  [d1, hw1[0]] <=> [d2, hw2[0]]
end

loop do
  h, w = gets.split.map(&:to_i)
  hw = [h, w]
  break if h | w == 0
  ans = [150, 150]
  (1..150).each do |i|
    (i+1..150).each do |j|
      ij = [i, j]
      if compare(hw, ij) < 0 && compare(ij, ans) < 0
        ans = ij
      end
    end
  end
  puts ans.join(" ")
end
