using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int H = 120; int W = 120; int HW = H*W; List[] E = new List[HW]; for(int i=0;i(); Func enc = (r,c) => r*W+c; var deg = new Dictionary(); for(int i=0;i Q = new Queue(); used[v] = true; Q.Enqueue(v); while(Q.Count>0){ var now = Q.Dequeue(); nc++; ne += E[now].Count; foreach(var nxt in E[now]){ if(!used[nxt]){ used[nxt] = true; Q.Enqueue(nxt); } } } ne /= 2; if(nc >= ne) continue; Console.WriteLine("NO"); return; } Console.WriteLine("YES"); } int N; int[] R0,C0,R1,C1; public Sol(){ N = ri(); R0 = new int[N]; R1 = new int[N]; C0 = new int[N]; C1 = new int[N]; for(int i=0;iint.Parse(e));} static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));} static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));} }