line = gets.chomp! abort unless line=~/^\d+$/ n=line.to_i abort unless 1 <= n && n <= 10000 n.times do line = gets.chomp! abort unless line=~/^\d+ \d+$/ y, x = line.split.map(&:to_i) abort unless 0 <= y && y <= 88 abort unless 0 <= x && x <= 100 end abort if gets