STDOUT.sync = true N, M = gets.split.map(&:to_i) M.times do a, b = gets.split.map(&:to_i) puts (a < b) ? 0 : 1 end