#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#pragma GCC optimize("unroll-loops")
//#pragma warning(disable : 4996)

#ifdef _MSC_VER
#include <intrin.h>

#define __builtin_popcount __popcnt
#define __builtin_popcountll __popcnt64
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

//#include<atcoder/all>

#include <vector>

namespace atcoder {

	namespace internal {

		template <class T> struct simple_queue {
			std::vector<T> payload;
			int pos = 0;
			void reserve(int n) { payload.reserve(n); }
			int size() const { return int(payload.size()) - pos; }
			bool empty() const { return pos == int(payload.size()); }
			void push(const T& t) { payload.push_back(t); }
			T& front() { return payload[pos]; }
			void clear() {
				payload.clear();
				pos = 0;
			}
			void pop() { pos++; }
		};

	}  // namespace internal

}  // namespace atcoder


namespace atcoder {

	template <class Cap> struct mf_graph {
	public:
		mf_graph() : _n(0) {}
		mf_graph(int n) : _n(n), g(n) {}

		int add_edge(int from, int to, Cap cap) {
			assert(0 <= from && from < _n);
			assert(0 <= to && to < _n);
			assert(0 <= cap);
			int m = int(pos.size());
			pos.push_back({ from, int(g[from].size()) });
			g[from].push_back(_edge{ to, int(g[to].size()), cap });
			g[to].push_back(_edge{ from, int(g[from].size()) - 1, 0 });
			return m;
		}

		struct edge {
			int from, to;
			Cap cap, flow;
		};

		edge get_edge(int i) {
			int m = int(pos.size());
			assert(0 <= i && i < m);
			auto _e = g[pos[i].first][pos[i].second];
			auto _re = g[_e.to][_e.rev];
			return edge{ pos[i].first, _e.to, _e.cap + _re.cap, _re.cap };
		}
		std::vector<edge> edges() {
			int m = int(pos.size());
			std::vector<edge> result;
			for (int i = 0; i < m; i++) {
				result.push_back(get_edge(i));
			}
			return result;
		}
		void change_edge(int i, Cap new_cap, Cap new_flow) {
			int m = int(pos.size());
			assert(0 <= i && i < m);
			assert(0 <= new_flow && new_flow <= new_cap);
			auto& _e = g[pos[i].first][pos[i].second];
			auto& _re = g[_e.to][_e.rev];
			_e.cap = new_cap - new_flow;
			_re.cap = new_flow;
		}

		Cap flow(int s, int t) {
			return flow(s, t, std::numeric_limits<Cap>::max());
		}
		Cap flow(int s, int t, Cap flow_limit) {
			assert(0 <= s && s < _n);
			assert(0 <= t && t < _n);

			std::vector<int> level(_n), iter(_n);
			internal::simple_queue<int> que;

			auto bfs = [&]() {
				std::fill(level.begin(), level.end(), -1);
				level[s] = 0;
				que.clear();
				que.push(s);
				while (!que.empty()) {
					int v = que.front();
					que.pop();
					for (auto e : g[v]) {
						if (e.cap == 0 || level[e.to] >= 0) continue;
						level[e.to] = level[v] + 1;
						if (e.to == t) return;
						que.push(e.to);
					}
				}
			};
			auto dfs = [&](auto self, int v, Cap up) {
				if (v == s) return up;
				Cap res = 0;
				int level_v = level[v];
				for (int& i = iter[v]; i < int(g[v].size()); i++) {
					_edge& e = g[v][i];
					if (level_v <= level[e.to] || g[e.to][e.rev].cap == 0) continue;
					Cap d =
						self(self, e.to, std::min(up - res, g[e.to][e.rev].cap));
					if (d <= 0) continue;
					g[v][i].cap += d;
					g[e.to][e.rev].cap -= d;
					res += d;
					if (res == up) break;
				}
				return res;
			};

			Cap flow = 0;
			while (flow < flow_limit) {
				bfs();
				if (level[t] == -1) break;
				std::fill(iter.begin(), iter.end(), 0);
				while (flow < flow_limit) {
					Cap f = dfs(dfs, t, flow_limit - flow);
					if (!f) break;
					flow += f;
				}
			}
			return flow;
		}

		std::vector<bool> min_cut(int s) {
			std::vector<bool> visited(_n);
			internal::simple_queue<int> que;
			que.push(s);
			while (!que.empty()) {
				int p = que.front();
				que.pop();
				visited[p] = true;
				for (auto e : g[p]) {
					if (e.cap && !visited[e.to]) {
						visited[e.to] = true;
						que.push(e.to);
					}
				}
			}
			return visited;
		}

	private:
		int _n;
		struct _edge {
			int to, rev;
			Cap cap;
		};
		std::vector<std::pair<int, int>> pos;
		std::vector<std::vector<_edge>> g;
	};

}  // namespace atcoder


using namespace std;
using namespace atcoder;


#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << endl
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << " \n"[i==(int)v.size()-1]
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9+7;
constexpr int MAX = 300010;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll LINF = 1e18 + 1;
constexpr int INF = 1e9 + 1;
void Yes(bool cond) { cout << (cond ? "Yes" : "No") << '\n'; }
void YES(bool cond) { cout << (cond ? "YES" : "NO") << '\n'; }



void solve() {
	int N; cin >> N;
	int cnt = 0;
	bool found = false;
	REP(i, N) {
		int a, b; cin >> a >> b;
		if (a == b) {
			cnt++;
			if (cnt >= 3)found = true;
		}
		else {
			cnt = 0;
		}
	}
	Yes(found);
}



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	//int q;
	//cin >> q;
	//while (q--)
	solve();

}


Measured memory_bytes: 3656