l=[]
for _ in range(int(int(input()))):
a,b=map(int,input().split())
l.append([a,1])
l.append([b+1,-1])
c=0
l.sort()
for x in l:
c+=x[1]
if c>2:print('NO');break
else: print('YES')
// © Urvish Patel
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define endll "\n"
#define f(var,srt,ed) for(int var=srt;var<ed;var++)
#define rf(var,srt,ed) for(int var=srt;var>ed;var--)
#define fe(var,cont) for(auto &var:cont)
#define pb push_back
#define begin begin()
#define end end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) ((a*b)/(__gcd(a,b)))
#define YES(x) cout<<"YES"<<x
#define NO(x) cout<<"NO"<<x
void solve()
{
int n;
cin>>n;
vector<pair<int,int>> tv;
f(i,0,n)
{
int l,r;
cin>>l>>r;
tv.pb({l,r});
}
sort(tv.begin,tv.end);
int ed1=-1,ed2=-1;
fe(it,tv)
{
int st=it.first,ed=it.second;
bool check=false;
if(ed1<st)
{
ed1=ed;
check=true;
}
else if(ed2<st)
{
ed2=ed;
check=true;
}
if(!check)
{
cout<<"NO"<<endl;
return ;
}
}
cout<<"YES"<<endl;
}
int main()
{
fast
int t=1;
//cin>>t;
f(_,0,t)
{
//cout<<"Case #"<<_<<": ";
solve();
}
return 0;
}
510B - Fox And Two Dots | 616D - Longest k-Good Segment |
1604A - Era | 555B - Case of Fugitive |
551A - GukiZ and Contest | 1399F - Yet Another Segments Subset |
1371C - A Cookie for You | 430B - Balls Game |
1263A - Sweet Problem | 1332B - Composite Coloring |
254A - Cards with Numbers | 215A - Bicycle Chain |
1288B - Yet Another Meme Problem | 1201C - Maximum Median |
435A - Queue on Bus Stop | 1409B - Minimum Product |
723B - Text Document Analysis | 1471C - Strange Birthday Party |
1199A - City Day | 1334A - Level Statistics |
67B - Restoration of the Permutation | 1734A - Select Three Sticks |
1734B - Bright Nice Brilliant | 357B - Flag Day |
937A - Olympiad | 1075A - The King's Race |
1734C - Removing Smallest Multiples | 1004C - Sonya and Robots |
922A - Cloning Toys | 817A - Treasure Hunt |