using System.Numerics; public class Program { public static void Main() { //BigInteger num = BigInteger.Parse(Console.ReadLine() ?? string.Empty); int num = int.Parse(Console.ReadLine() ?? string.Empty); //string[] moji = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); //string str = Console.ReadLine() ?? string.Empty; List list = new List(); for (int i = 0; i < num; i++) { string[] moji = (Console.ReadLine() ?? string.Empty).Trim().Split(' '); list.Add(moji[0]); list.Add(moji[1]); } if(num == 1) { Console.WriteLine("Yes"); return; } string w = ""; for (int i = 0;i < list.Count;i++) { int index= list.LastIndexOf(list[i]); int d= list.IndexOf(list[i]); if (index == i&&d == i) { continue; } if(i % 2 == 0) { w = i.ToString(); } else if(i % 2 != 0&& w != ""&& int.Parse(w) == i-1) { Console.WriteLine("No"); return; } else if(i%2 !=0&&w!="") { w = ""; } } Console.WriteLine("Yes"); } }