defmodule Main do def main do 1..(IO.read(:line) |> String.trim() |> String.to_integer()) |> Enum.map(fn _ -> IO.read(:line) |> String.split() |> Enum.map(&String.to_integer/1) end) |> solve |> IO.puts() end def solve(a) do a |> Enum.sort(fn [a, b], [c, d] -> c / d <= a / b end) |> Enum.map(&Enum.join(&1, " ")) |> Enum.join("\n") end end