#include #include #include #include using namespace std; int main(void) { int N, A[20], B[20], flag = 1, c = 0; cin>>N; int a, b; cin>>A[0]>>B[0]; cin>>A[1]>>B[1]; if(A[0] == A[1]) { a = A[0]; c = 1; } else if(B[0] == B[1]) { b = B[0]; c = 2; } for(int i = 2; i < N; i++) { cin>>A[i]>>B[i]; if(c == 1) { if(A[i] != a) { flag = 0; } } else if(c == 2) { if(B[i] != b) { flag = 0; } } } if(c == 0) flag = 0; if(flag == 1) cout<<"YES\n"; else cout<<"NO\n"; return 0; }