import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

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

	public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	}
} Main public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	} main {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	} int ans = 0; ans 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int hako=0; hako 0 for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		} {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			} a==b a b {
				ans++;
				if(ans==3){
					hako=1;
				}
			} ans++ ans if(ans==3){
					hako=1;
				} ans==3 ans 3 {
					hako=1;
				} hako=1 hako 1 {
				ans=0;
			} ans=0 ans 0 if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		} hako==1 hako 1 {
			System.out.print("Yes");
		} System.out.print("Yes") System.out.print System.out System System.out "Yes" {
			System.out.print("No");
		} System.out.print("No") System.out.print System.out System System.out "No" String[] args args public class Main {

	public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	}
} public class Main {

	public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int hako=0;
		
		for(int i=0;i<n;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			if(a==b) {
				ans++;
				if(ans==3){
					hako=1;
				}
			}
			else {
				ans=0;
			}
		}
		
		if(hako==1) {
			System.out.print("Yes");
		}
		else {
			System.out.print("No");
		}

	}
}
