import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
} import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
} Main static int[][] map; map static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}}; directions8 {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}} {-1,-1} -1 1 -1 1 {-1,0} -1 1 0 {-1,1} -1 1 1 {0,-1} 0 -1 1 {0,1} 0 1 {1,-1} 1 -1 1 {1,0} 1 0 {1,1} 1 1 static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}}; directions4 {{-1,0},{1,0},{0,-1},{0,1}} {-1,0} -1 1 0 {1,0} 1 0 {0,-1} 0 -1 1 {0,1} 0 1 static int ans; ans static int[] parent;//union-find用 parent static int[] rank;//union-find用 rank public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	} main {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[][] D = new int[N][2]; D new int[N][2] N 2 for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		} {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		} D[i][0]=sc.nextInt() D[i][0] D[i] D i 0 sc.nextInt() sc.nextInt sc D[i][1]=sc.nextInt() D[i][1] D[i] D i 1 sc.nextInt() sc.nextInt sc boolean ans = false; ans false int zoro = 0; zoro 0 for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		} int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		} {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		} if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			} D[i][0]==D[i][1] D[i][0] D[i] D i 0 D[i][1] D[i] D i 1 {
				zoro++;
			} zoro++ zoro {
				zoro=0;
			} zoro=0 zoro 0 if(zoro==3) {
				ans = true;
				break;
			} zoro==3 zoro 3 {
				ans = true;
				break;
			} ans = true ans true break; if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		} ans {
			System.out.println("Yes");
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" String[] args args //素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	} isPrime {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	} if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く num < 2 num 2 return false; false if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く num == 2 num 2 return true; true if (num % 2 == 0) return false; // 偶数はあらかじめ除く num % 2 == 0 num % 2 num 2 0 return false; // 偶数はあらかじめ除く false double sqrtNum = Math.sqrt(num); sqrtNum Math.sqrt(num) Math.sqrt Math num for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		} int i = 3; int i = 3; i 3 i <= sqrtNum i sqrtNum i += 2 i += 2 i 2 {
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		} {
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		} if (num % i == 0)
			{
				// 素数ではない
				return false;
			} num % i == 0 num % i num i 0 {
				// 素数ではない
				return false;
			} return false; false return true; true long num num //BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	} addArrayElms {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	} int[] c = new int[a.length]; c new int[a.length] a.length a a.length for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		} int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
			c[i] = a[i] + b[i];
		} {
			c[i] = a[i] + b[i];
		} c[i] = a[i] + b[i] c[i] c i a[i] + b[i] a[i] a i b[i] b i return c; c int[] a a int[] b b //	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	} binarySearch {
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	} int lowerBorder = -1; lowerBorder -1 1 int upperBorder = orderedArray.length; upperBorder orderedArray.length orderedArray orderedArray.length int mid; mid while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		} upperBorder - lowerBorder >1 upperBorder - lowerBorder upperBorder lowerBorder 1 {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		} mid = (upperBorder + lowerBorder)/2 mid (upperBorder + lowerBorder)/2 (upperBorder + lowerBorder) upperBorder lowerBorder 2 if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			} orderedArray[mid]<=num orderedArray[mid] orderedArray mid num {
				lowerBorder = mid;
			} lowerBorder = mid lowerBorder mid {
				upperBorder = mid;
			} upperBorder = mid upperBorder mid return lowerBorder; lowerBorder long num num long[] orderedArray orderedArray //二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	} binarySearch {
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	} int lowerBorder = -1; lowerBorder -1 1 int upperBorder = orderedList.size(); upperBorder orderedList.size() orderedList.size orderedList int mid; mid while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		} upperBorder - lowerBorder >1 upperBorder - lowerBorder upperBorder lowerBorder 1 {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		} mid = (upperBorder + lowerBorder)/2 mid (upperBorder + lowerBorder)/2 (upperBorder + lowerBorder) upperBorder lowerBorder 2 if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			} orderedList.get(mid)<=num orderedList.get(mid) orderedList.get orderedList mid num {
				lowerBorder = mid;
			} lowerBorder = mid lowerBorder mid {
				upperBorder = mid;
			} upperBorder = mid upperBorder mid return lowerBorder; lowerBorder long num num ArrayList<Long> orderedList orderedList //aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	} gcd {
		return b == 0 ? a: gcd(b, a % b);
	} return b == 0 ? a: gcd(b, a % b); b == 0 ? a: gcd(b, a % b) b == 0 b 0 a gcd(b, a % b) gcd b a % b a b int a a int b b public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	} gcd {
		return b == 0 ? a: gcd(b, a % b);
	} return b == 0 ? a: gcd(b, a % b); b == 0 ? a: gcd(b, a % b) b == 0 b 0 a gcd(b, a % b) gcd b a % b a b long a a long b b //Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	} ufInit {
		parent = new int[n];
		rank = new int[n];
	} parent = new int[n] parent new int[n] n rank = new int[n] rank new int[n] n int n n //Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	} ufFind {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	} if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		} parent[a]==a parent[a] parent a a {
			return a;
		} return a; a {
			return ufFind(parent[a]);
		} return ufFind(parent[a]); ufFind(parent[a]) ufFind parent[a] parent a int a a //Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	} ufUnite {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	} a = parent[a] a parent[a] parent a b = parent[b] b parent[b] parent b if(a==b) {
			return;
		} a==b a b {
			return;
		} return; if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		} rank[a] > rank[b] rank[a] rank a rank[b] rank b {
			parent[b]=a;
		} parent[b]=a parent[b] parent b a {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		} parent[a]=b parent[a] parent a b if(rank[a]==rank[b]) {
				rank[b]++;
			} rank[a]==rank[b] rank[a] rank a rank[b] rank b {
				rank[b]++;
			} rank[b]++ rank[b] rank b int a a int b b static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	} ufSame {
		return ufFind(a)==ufFind(b);
	} return ufFind(a)==ufFind(b); ufFind(a)==ufFind(b) ufFind(a) ufFind a ufFind(b) ufFind b int a a int b b public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
} public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
} Main
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static int ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();

		int[][] D = new int[N][2];

		for(int i = 0;i<N ; i++) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		boolean ans = false;
		int zoro = 0;

		for(int i = 0;i<N ; i++) {
			if(D[i][0]==D[i][1]) {
				zoro++;
			}else {
				zoro=0;
			}
			if(zoro==3) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
}
