import java.util.*;
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} import java.util.*; util.* java public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} Main static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	} solve {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt() n sc.nextInt() sc.nextInt sc t = 0; t 0 while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		} n-->0 n-- n 0 {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		} int a = sc.nextInt() a sc.nextInt() sc.nextInt sc b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if (a==b) t++; else t=0; a==b a b t++ t t=0 t 0 if (t==3) break; t==3 t 3 break; System.out.println(t==3 ? "Yes" : "No") System.out.println System.out System System.out t==3 ? "Yes" : "No" t==3 t 3 "Yes" "No" sc.close() sc.close sc public static void main(String args[]) {
		solve();
	} main {
		solve();
	} solve() solve String args[] args public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

} Main
import java.util.*;
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), t = 0;
		while (n-->0) {
			int a = sc.nextInt(), b = sc.nextInt();
			if (a==b) t++; else t=0;
			if (t==3) break;
		}
		System.out.println(t==3 ? "Yes" : "No");
		sc.close();			
	}

	public static void main(String args[]) {
		solve();
	}

}