#include using namespace std; #define FOR(i, a, b) for(int i = (a); i < (b); ++i) #define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i) #define REP(i, N) FOR(i, 0, N) #define RREP(i, N) RFOR(i, N, 0) #define FILL(A,value) memset(A,value,sizeof(A)) #define all(V) V.begin(), V.end() #define sz(V) (int)V.size() #define pb push_back #define mp make_pair #define Pi 3.14159265358979 #define pp(a) cout< vi; typedef long double ld; typedef pair pii; inline ld gett() { return ld(clock()) / CLOCKS_PER_SEC; } const ll MOD = 1000000007; void solve() { int n,x,y,p,q; cin>>n; cin>>x>>y; int f=0; FOR(i,0,n-1) { cin>>p>>q; if(p!=x && q!=y){f=1;break;} } if(f==0)cout<<"YES"; else cout<<"NO"; } int main() { ios::sync_with_stdio(false);cin.tie(0); ld stime = gett(); solve(); cerr << "Time: "<< gett() - stime << endl; return 0; }