using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution { static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); int number = 0; string a = "YES"; int number1 = 0; for (int a0 = 0; a0 < n; a0++) { string[] tokens_x = Console.ReadLine().Split(' '); int x = Convert.ToInt32(tokens_x[0]); int y = Convert.ToInt32(tokens_x[1]); if (n >= 2) { if (a0 == 0) { number = x; number1 = y; } if (number != x) { a = "NO"; //continue; } else if (number <= x) { a = "YES"; } if (a == "NO") { if (number1 != y) { a = "NO"; break; } else if (number1 <= y) { a = "YES"; } } } else { a = "YES"; } } Console.WriteLine(a); } }