// Problem : B - Go to Jail
// Contest : AtCoder - AtCoder Beginner Contest 179
// URL : https://atcoder.jp/contests/abc179/tasks/abc179_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//Code by : Abhishek Tiwari @devil_within
#include<bits/stdc++.h>
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define pb push_back
#define pf push_front
#define ff first
#define ss second 
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define VI vector<int>
#define ll long long 
#define int int64_t
#define pii pair<int,int> 
#define ar array
const int mod = 1e9 + 7;
const ll INF = 1e15;
const double PI = acos(-1);
using namespace std;

/*******************************************************************************************/
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { 
    os<<"["; for(int i=0;i<v.size(); ++i) {if(i) os<<", "; os<<v[i]; }  
    os<<"]\n"; return os; 
} 
template <typename T> ostream& operator<<(ostream& os, const set<T>& v) { 
    os<<"{"; for(auto it : v) { os<<it; if(it!=*v.rbegin()) os<<", "; } os<<"}\n"; 
    return os; 
}
template <typename T, typename S> ostream& operator<<(ostream& os, const map<T, S>& v) { 
    os<<"{"; for(auto it:v){ os<<"("<<it.first<<" : "<<it.second<<")"; if(it!=*v.rbegin()) os<<", "; } os<<"}\n"; 
    return os; 
}
template <typename T, typename S> ostream& operator<<(ostream& os, const pair<T, S>& v) { 
    os<<"("; os<<v.first<<", "<< v.second<<")"; 
    return os; 
} 
template <typename T> inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x; 
    return in;
}
/*******************************************************************************************/
//N dimensional Vector, Vec<n , int> 
template<int D, typename T>
struct Vec : public vector<Vec<D - 1, T>> {
  static_assert(D >= 1, "Vector dimension must be greater than zero!");
  template<typename... Args>
  Vec(int n = 0, Args... args) : vector<Vec<D - 1, T>>(n, Vec<D - 1, T>(args...)) {
  }
};
template<typename T>
struct Vec<1, T> : public vector<T> {
  Vec(int n = 0, const T& val = T()) : vector<T>(n, val) {
  }
};
/*******************************************************************************************/
int fpow(int x,int y,int p); 



int32_t main()  
{
#ifndef ONLINE_JUDGE
//freopen("input.txt" , "r" , stdin);freopen("output.txt" , "w" , stdout);freopen("error.txt" , "w" , stderr);
#endif
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//cout << fixed << setprecision(12);
int T = 1;
//cin >> T;
for(int tc = 1 ; tc <= T; ++tc )
{	
	int n;
	cin >> n;
	int a[n];
	int b[n];
	for(int i = 0 ; i < n; ++i) cin >> a[i] >> b[i];
	bool f = false;
	for(int i = 1; i < n-1; ++i) {
		if(a[i] == b[i] && a[i-1] == b[i-1] && a[i+1] == b[i+1])
			f = true;
	}
	if(f) cout << "Yes\n";
	else cout << "No\n";

	//cout << "Case #"<<tc<<": \n";

}
return 0;
}



//Functions 
int fpow(int x, int y, int p) { 
   int res = 1; 
   x = x % p;  
   while (y > 0) { 
     if (y & 1) res = (res * x) % p; 
     	y = y >> 1; 
        x = (x * x) % p; 
    } 
    return res; 
} 

/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
template<class T> using oset = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
*/


Measured memory_bytes: 3660