var n,i :longint; ok1,ok2 :boolean; x,y :array[0..15] of longint; begin read(n); ok1:=true; ok2:=true; for i:=1 to n do begin read(x[i],y[i]); if x[i]<>x[1] then ok1:=false; if y[i]<>y[1] then ok2:=false; end; if (not ok1) and (not ok2) then write('NO') else write('YES'); end.