Program BiChromaticCheck; Const MaxV=400; Type PVert = ^Vert; Vert = Record n: Word; next: PVert; End; Var fin, fout: Text; N, line: Word; V, i, a, b: Word; C: Array [1..MaxV, 1..MaxV] of Boolean; color: Array [1..MaxV+1] of Word; first, last, tmp: PVert; colora: Byte; ok: Boolean; Begin Assign(fin,'bichrom.in'); Reset(fin); Assign(fout,'bichrom.out'); Rewrite(fout); Readln(fin,N); For line:= 1 To N Do Begin Read(fin,V); FillChar(C, SizeOf(C), False); FillChar(color, SizeOf(color), False); While (not SeekEoLn(fin)) Do Begin Read(fin, a); Read(fin, b); C[a,b]:= True; C[b,a]:= True; End; Readln(fin); ok:= True; b:= 1; Repeat While color[b]<>0 Do Inc(b); If b>V Then Break; color[b]:= 1; New(first); first^.n:= b; first^.next:= Nil; last:= first; While first<>Nil Do Begin a:= first^.n; colora:= color[a]; For i:= 1 To V Do Begin If C[a,i] Then Begin If color[i]=0 Then Begin color[i]:= 3-colora; New(last^.next); last:= last^.next; last^.next:= Nil; last^.n:= i; End Else Begin If color[i]=colora Then Begin ok:= False; While first<>Nil Do Begin tmp:= first; first:= first^.next; Dispose(tmp); b:= V+1; Break; End; End; End; End; End; If first<>Nil Then Begin tmp:= first; first:= first^.next; Dispose(tmp); End; End; Until False; If ok Then Writeln(fout,'YES') Else Writeln(fout,'NO'); End; Close(fin); Close(fout); End.