N = gets.to_i X = N.times.map { gets.split.map(&:to_i) } grid = Array.new(10) { Array.new(10) } grid[2][8] = 'A' grid[3][9] = 'B' grid[7][9] = 'C' X.each do |fy, fx, ty, tx| grid[ty][tx] = grid[fy][fx] grid[fy][fx] = nil end if grid[5][8] == 'A' && grid[4][8] == 'B' && grid[6][8] == 'C' puts 'YES' else puts 'NO' end