import java.util.Scanner;
import java.util.Queue;
import java.util.ArrayDeque;
import java.util.Arrays;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}

} import java.util.Scanner; Scanner java.util import java.util.Queue; Queue java.util import java.util.ArrayDeque; ArrayDeque java.util import java.util.Arrays; Arrays java.util public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}

} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	} main {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	} 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[2][n]; d new int[2][n] 2 n for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		} {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		} d[0][i] = sc.nextInt() d[0][i] d[0] d 0 i sc.nextInt() sc.nextInt sc d[1][i] = sc.nextInt() d[1][i] d[1] d 1 i sc.nextInt() sc.nextInt sc String ans = "No"; ans "No" for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		} int i = 0; int i = 0; i 0 i < n - 2 i n - 2 n 2 i++ i++ i {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		} {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		} if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			} d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] d[0][i]==d[1][i] d[0][i] d[0] d 0 i d[1][i] d[1] d 1 i d[0][i+1]==d[1][i+1] d[0][i+1] d[0] d 0 i+1 i 1 d[1][i+1] d[1] d 1 i+1 i 1 d[0][i+2]==d[1][i+2] d[0][i+2] d[0] d 0 i+2 i 2 d[1][i+2] d[1] d 1 i+2 i 2 {
				ans = "Yes";
			} ans = "Yes" ans "Yes" 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 sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}

} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}

} Main
import java.util.Scanner;
import java.util.Queue;
import java.util.ArrayDeque;
import java.util.Arrays;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int[][] d = new int[2][n];
		for(int i = 0; i < n; i++) {
			d[0][i] = sc.nextInt();
			d[1][i] = sc.nextInt();
		}
		String ans = "No";
		for(int i = 0; i < n - 2; i++) {
			if(d[0][i]==d[1][i] && d[0][i+1]==d[1][i+1] && d[0][i+2]==d[1][i+2] ) {
				ans = "Yes";
			}
		}
		System.out.println(ans);
	}

}