def point_number_calc(dist, rad)
  d = dist / 100.0
  r = rad / 30.0

  [d.floor + 5 * r.floor, d.ceil + 5 * r.floor,
   d.floor + 5 * r.ceil, d.ceil + 5 * r.ceil].uniq.join(" ")
end

gets.to_i.times do
  dist, rad = gets.chomp.split(" ").map(&:to_i)
  puts point_number_calc(dist, rad)
end