#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define sz size() #define pb push_back #define mp make_pair #define fo(i, n) for ( i = 1; i <= (int)(n); i++) #define fr(i, k, n) for ( i = k; i <= (int)(n); i++) #define sortvektor(s) sort((s).begin(),(s).end()) #define reversevektor(s) reverse((s).begin(),(s).end()) #define fro(i, n) for ( i = 0; i < (int)(n); i++) #define meset(x,y) memset((x),(y),sizeof((x))) long long stoll (string target) { stringstream s; s << target; long long w; s >> w; return w;} int stoi (string target) { stringstream s; s << target; int w; s >> w; return w;} string itos (int i) {stringstream s; s << i; return s.str();} string lltos (long long i) {stringstream s; s << i; return s.str();} int main() { ios::sync_with_stdio(false); // freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); bool ok=true,final=false; int i,j,k,n,m; int t; int br=0,odgovor=0,pom=0,mom=0,g=0,f=0,pamti=0; // cin>>t; while(t--) int a[100001],b[100]; meset(a,0); // cin>>t; while(t--) cin>>n; fo(i,n) cin>>a[i]>>b[i]; ok=true; fo(i,n) if (a[i]!=a[1]) ok=false; if (ok) { cout<<"YES"; return 0;} ok=true; fo(i,n) if (b[i]!=b[1]) ok=false; if (ok) { cout<<"YES"; return 0;} cout<<"NO"; return 0; }