#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;


int main(){
    int n;
    cin >> n;
    int xx, yy;
    cin >> xx >> yy;
    int k = 0;
    for(int a0 = 1; a0 < n; a0++){
        int x;
        int y;
        cin >> x >> y;
        if (x != xx) k |= 1;
        if (y != yy) k |= 2;
    }
    puts(k < 3 ? "YES" : "NO");
    return 0;
}