#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<math.h>
#include<set>
#include<sstream>

using namespace std;

//-----------------------------------------------------------------------------------------------------------//

#define ll         long long int
#define ull        unsigned long long int
#define ld         long double
#define endl       '\n'
#define ff         first
#define ss         second
#define pb         push_back
#define mod        1000000007
#define vll        vector<ll>
#define vchar      vector<char>
#define vstr       vector<string>
#define all(v)     v.begin(),v.end()
#define f(i,x,n)   for(ll i=x;i<n;i++)
#define fo(i,x,n)  for(ll i=x;i>=n;i--)
#define take(a)    for(auto &i:a)cin>>i;
#define print(a)   for(auto i:a)cout<<i<<" ";
#define prec(n,x)  cout<<fixed<<setprecision(x)<<n<<endl
#define srt(x)     sort(x.begin(),x.end())
#define rev_srt(x) sort(x.begin(),x.end(),greater<ll>())
#define fast       ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

//-----------------------------------------------------------------------------------------------------------//

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll x = gcd(a, b);
    return (a * b / x);
}

ll to_int(string s)
{
    stringstream conv(s);
    ll x;
    conv >> x;
    return x;
}

string leftrotate(string s, ll d)
{
    reverse(s.begin(), s.begin() + d);
    reverse(s.begin() + d, s.end());
    reverse(s.begin(), s.end());
    return s;
}

string rightrotate(string s, ll d)
{
    d = s.length() - d;
    reverse(s.begin(), s.begin() + d);
    reverse(s.begin() + d, s.end());
    reverse(s.begin(), s.end());
    return s;
}

ll factorial(ll n)
{
    ll ans = 1;
    f(i, 1, n + 1)
    {
        ans = (ans * i) % mod;
    }
    return ans;
}

ll isprime(ll n)
{
    if (n == 1 || n == 3)
        return 0;
    if (n == 2)
        return 1;
    f(i, 2, sqrt(n) + 1)
    {
        if (n % i == 0)
            return 0;
    }
    return 1;
}

ll ispowerof2 (ll num )
{
    if ( ( num & ( num - 1 ) ) == 0 )
        return 1;
    return 0;
}

ll power(ll x, ll y)
{
    ll ans = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
        {
            ans = (ans * x) % mod;
        }
        x = (x * x) % mod;
        y = y >> 1;
    }
    return ans;
}

double nthRoot(ll A, ll N)
{
    double xPre = rand() % 10, eps = 1e-3, delX = INT_MAX, xK;

    while (delX > eps)
    {
        xK = ((N - 1.0) * xPre +
              (double)A / pow(xPre, N - 1)) / (double)N;
        delX = abs(xK - xPre);
        xPre = xK;
    }

    return xK;
}

long double po(long double x, long double y)
{
    long double ans = 1;
    long double a = 1.0;

    ull temp = int(y);
    while (temp > 0)
    {
        /*ans = ans * x;
        y--;*/
        if (temp & 1)
        {
            ans = (ans * x);
        }
        x = (x * x);
        temp = temp >> 1;
    }
    return ans;
}

ll decimalToBinary(ll n)
{
    ll num = 0, cnt = 0;
    while (n != 0)
    {
        ll rem = n % 2;
        ll c = power(10, cnt);
        num += rem * c;
        n /= 2;
        cnt++;
    }
    return num;
}

vector<ll> subsetSums(vector<ll> arr, ll n)
{
    vector<ll> ans;
    long long total = 1 << n;

    for (long long i = 0; i < total; i++)
    {
        long long sum = 0, cnt = 0;

        for (int j = 0; j < n; j++)
            if (i & (1 << j))
            {
                sum += arr[j];
            }

        ans.pb(sum);
    }
    return ans;
}

string to_string(ll n)
{
    ostringstream str1;
    str1 << n;
    string s = str1.str();
    return s;
}

ll binarySearch(vll a, ll key)
{
    ll low = 0, high = a.size() - 1, ans;
    while (low <= high)
    {
        ll mid = (low) + (high - low) / 2;
        if (a[mid] < key)
        {
            low = mid + 1;
            ans = mid;
        }
        else if (a[mid] > key)
        {
            high = mid - 1;
            ans = mid;
        }
        else
        {
            return mid;
        }
    }
    return ans;                //key not found
}

double to_double(string s)
{
    stringstream geek(s);
    double x = 0;
    geek >> x;
    return x;
}

int lcs(string x, string y, int i, int j)
{
    if (i == 0 || j == 0)
        return 0;
    if (x[i] == y[j])
        return 1 + lcs(x, y, i - 1, j - 1);
    else
    {
        return max(lcs(x, y, i - 1, j), lcs(x, y, i, j - 1));
    }
}

string showstack(stack <char> s)
{
    string ans;
    while (!s.empty())
    {
        ans = ans + s.top();
        s.pop();
    }

    return ans;
}

//************************************************************************************************************//

int main()
{

#ifndef ONLINE_JUDGE
    freopen("F:/Programming/Codes/input.txt", "r", stdin);
    freopen("F:/Programming/Codes/output.txt", "w", stdout);
#endif

    fast;

    ll t = 1;
    //cin >> t;

    while (t--)
    {
        ll n;
        cin >> n;

        ll cnt = 0, flag = 0;

        f(i, 0, n)
        {
            ll a, b;
            cin >> a >> b;

            if (a == b)
            {
                cnt++;
                if (cnt >= 3)
                    flag = 1;
            }
            else
            {
                if (cnt >= 3)
                    flag = 1;
                cnt = 0;
            }

        }

        if (flag)
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3684