import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static long mod = 1000000007;
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  }
} import java.util.*; util.* java import java.io.*; io.* java import java.math.BigInteger; BigInteger java.math public class Main {
	public static long mod = 1000000007;
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  }
} Main public static long mod = 1000000007; mod 1000000007 public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  } main {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  } Scanner s = new Scanner(System.in); s new Scanner(System.in) int N = s.nextInt(); N s.nextInt() s.nextInt s boolean is = false; is false int[][] D = new int[N][2]; D new int[N][2] N 2 for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	} {
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	} D[i][0] = s.nextInt() D[i][0] D[i] D i 0 s.nextInt() s.nextInt s D[i][1] = s.nextInt() D[i][1] D[i] D i 1 s.nextInt() s.nextInt s for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	} int i = 0; int i = 0; i 0 i < N-2 i N-2 N 2 i++ i++ i {
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	} {
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	} if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		} (D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1]) (D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1]) (D[i][0]==D[i][1]) D[i][0] D[i] D i 0 D[i][1] D[i] D i 1 (D[i+1][0]==D[i+1][1]) D[i+1][0] D[i+1] D i+1 i 1 0 D[i+1][1] D[i+1] D i+1 i 1 1 (D[i+2][0]==D[i+2][1]) D[i+2][0] D[i+2] D i+2 i 2 0 D[i+2][1] D[i+2] D i+2 i 2 1 {
			is = true;
		} is = true is true if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	} is {
		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 class Main {
	public static long mod = 1000000007;
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  }
} public class Main {
	public static long mod = 1000000007;
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  }
} Main
import java.util.*;
import java.io.*;
import java.math.BigInteger;
 
public class Main {
	public static long mod = 1000000007;
	
	public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int N = s.nextInt();
	boolean is = false;
	int[][] D = new int[N][2];
	for(int i = 0; i < N; i++){
		D[i][0] = s.nextInt();
		D[i][1] = s.nextInt();
	}

	for(int i = 0; i < N-2; i++){
		if((D[i][0]==D[i][1]) && (D[i+1][0]==D[i+1][1]) && (D[i+2][0]==D[i+2][1])){
			is = true;
		}
	}
	if(is){
		System.out.println("Yes");
	}else{
		System.out.println("No");
	}
	
    
  }
}