#include "bits/stdc++.h"
using namespace std;

#define ASC 0
#define DESC 1
#define INF (1e9 + 7)
#define MOD (1e9 + 7)


#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define mp make_pair

#define fr(i, a, b) for (int i = a; i <= b; i++)
#define rfr(i, a, b) for (int i = b; i >= a; i--)

// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);

//typedef __int128 lfr; // llll => l four => lfr
typedef long long ll; // long long
typedef long double ld; // long double
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<float> vf;
typedef vector<double> vd;
typedef map<string, int> msi;
typedef map<int, int> mii;
typedef set<int> si;
typedef unordered_set<int> usi;
typedef unordered_multiset<int> umsi;
typedef multiset<int> mlsi;
typedef set<string> ss;
typedef pair<int, int> pi;

template  <class T> T GCD(T a, T b) { return (b != 0 ? GCD <T> (b, a%b) : a); }
template  <class T> T LCM(T a, T b) { return ((a*b)  / GCD <T> (a, b)); }

class Utl {
public:
    template<class mixed>
    static void print(mixed value) {
        std::cout << value;
    }

    template<class mixed, class padd>
    static void print(mixed prefix, padd suffix) {
        std::cout  << prefix << suffix;
    }
    
    template<class mixed>
    static void print(mixed value, bool space) {
        if (space) std::cout << value << " ";
        else std::cout << value;
    }
    
    
    template<class mixed>
    static void println(mixed value) {
        std::cout << value << std::endl;
    }
    
    static void println() {
        std::cout << endl;
    }

    
    template<class mixed>
    static void log(vector<mixed> arr, bool nl = false) {
        fr(i, 0, arr.size() - 1) Utl::print(arr[i], " ");
        if (nl) Utl::println();
    }
    
    template<class mixed>
    static void log(mixed arr[], int len, bool nl = false) {
        fr(i, 0, len - 1) Utl::print(arr[i], " ");
        if (nl) Utl::println();
    }
    
    template<class mixed>
    static vector<mixed> sort(vector<mixed> vec, int dir = ASC) {
        if (dir == DESC) std::sort(vec.begin(), vec.end(), greater<mixed>());
        else std::sort(vec.begin(), vec.end());
        return vec;
    }
    
    static vi sort(vi vec, std::function<bool(int, int)> dir) {
        std::sort(vec.begin(), vec.end(), dir);
        return vec;
    }

    static vector<char> split(string str) {
        vector<char> vec;
        for (int i = 0; i < str.size(); i++) vec.pb(str[i]);
        return vec;
    }
    
    template<class mixed>
    static mixed min(vector<mixed> vec) {
        return *min_element(vec.begin(), vec.end());
    }
    
    template<class mixed>
    static mixed max(vector<mixed> vec) {
        return *max_element(vec.begin(), vec.end());
    }
    
    template<class mixed>
    static mixed sum(vector<mixed> vec) {
        return accumulate(vec.begin(), vec.end(), 0);
    }
    
    template<class mixed>
    static vector<mixed> reverse(vector<mixed> vec) {
        std::reverse(vec.begin(), vec.end());
        return vec;
    }
    
    /**
     every, some methods
     */
    template<class mixed>
    static bool every(vector<mixed>vec, std::function<bool(const mixed)> callback) {
        return all_of(vec.begin(), vec.end(), callback);
    }
    
    template<class mixed>
    static bool some(vector<mixed>vec, std::function<bool(const mixed)> callback) {
        return any_of(vec.begin(), vec.end(), callback);
    }
    
    template<class mixed>
    static vector<mixed> map(vector<mixed> vec, std::function<mixed(const mixed)> callback) {
        vector<mixed> ret;
        for (auto &el: vec) ret.pb(callback(el));
        return ret;
    }
    
    template<class mixed>
    static vector<mixed> filter(vector<mixed> vec, std::function<mixed(const mixed)> callback) {
        vector<mixed> ret;
        for (auto &el: vec) {
            if (callback(el)) ret.pb(el);
        }
        return ret;
    }
    
    static string toString(int num) {
        return to_string(num);
    }
    
    static int parseInt(string num) {
        return stoi(num);
    }
};


vi getPsum(vi vec) {
    vi ans;
    ans.pb(vec[0]);
    
    fr(i, 1, int(vec.size()) - 1) ans.pb(ans[i-1] + vec[i]);
    
    return ans;
}

void solve() {
    int n; cin >> n;
    vector<pair<int, int>>roll;
    fr(i, 1, n) {
        int x, y; cin >> x >> y;
        roll.pb(make_pair(x, y));
    }
    bool ok = false;
    fr(i, 0, n - 3) {
        auto d1 = roll[i], d2 = roll[i+1], d3 = roll[i+2];
        if (d1.f == d1.s && d2.f == d2.s && d3.f == d3.s) {
            ok = true;
            break;
        }
    }
    
    cout << (ok ? "Yes": "No") << endl;
}



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int t = 1;

    while(t--) solve();
    
    return 0;

}


Measured memory_bytes: 3656