#include #include #include #include #include #include using namespace std; map x,y; int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ int n,i,j,k,l,m; cin>>n; m=n; int count1,count2; count1=count2=0; while (n--) { cin>>j>>k; if (x.find(j)!=x.end()) count1++; if (y.find(k)!=y.end()) count2++; x[j]++; y[k]++; } n=m; if (count1==n-1 || count2==n-1) cout<<"YES"<