import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
} import java.util.*; util.* java import java.math.*; math.* java public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
} Main public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	} main {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	} Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int cnt = 0; cnt 0 String ans = "No"; ans "No" for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		} {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		} int a = in.nextInt(); a in.nextInt() in.nextInt in int b = in.nextInt(); b in.nextInt() in.nextInt in if(a == b) cnt += 1;
			else cnt = 0; a == b a b cnt += 1 cnt 1 cnt = 0 cnt 0 if(cnt >= 3) {
				ans = "Yes";
				break;
			} cnt >= 3 cnt 3 {
				ans = "Yes";
				break;
			} ans = "Yes" ans "Yes" break; System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
} public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
} Main
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int cnt = 0;
		String ans = "No";
		for(int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a == b) cnt += 1;
			else cnt = 0;
			if(cnt >= 3) {
				ans = "Yes";
				break;
			}
		}
		System.out.println(ans);
	}
}