HWs = readlines.map(&:chomp).map{|s|s.split.map(&:to_i)}

def f(a,b)
  ra=a[1]**2+a[2]**2
  rb=b[1]**2+b[2]**2
  if ra>rb then return true end
  if a[1] > b[1]
    return true
    else
    return false
    end
end

HWs.each{|hh,ww|
  if hh==0 && ww==0 then break end
  rr=hh**2+ww**2
  cands = []
  1.upto(150){|h|
    (h+1).step{|w|
      if h==hh and w==ww then next end
      r = h**2 + w**2
      if r >= rr
        cands.push([r,h,w])
        break
      end
    }
  }
  #rr_min = cands.min_by{|rr,h,w| rr}[0]
  #min = cands.select{|rr,h,w|
  #  if rr == rr_min
  #    h>=hh
  #  else rr_min > rr
  #  end}.min_by{|rr,h,w| h}
  #puts min[1..2]*' '
  puts cands.select{|x| f(x, [rr, hh, ww])}.min_by{|rr,h,w| if w>h then rr*1000+h else 1/0.0 end}[1..2]*' '
}
