#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
bool ans=true;
struct yyds{
ll a;
ll b;
}x[200005];
bool cmp(yyds awa,yyds qwq){
return (awa.a<qwq.a);
}
int main(){
ios::sync_with_stdio(false);
cin>>n;
for (ll i=1;i<=n;i++){
cin>>x[i].a>>x[i].b;
if (x[i].a>x[i].b) swap(x[i].a,x[i].b);
}
sort(x+1,x+n+1,cmp);
for (ll i=1;i<n;i++){
if ((x[i].a<x[i+1].a) && (x[i].b<x[i+1].b) && (x[i].b>x[i+1].a)){
ans=false;
}
}
if (!ans) cout<<"Yes";
else cout<<"No";
return 0;
}
WA1,AC30
Where is the problem?