import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);     
      int N = sc.nextInt();
      boolean[] J = new boolean[N];
      int[] D1 = new int[N];
      int[] D2 = new int[N];
      for(int i = 0;i<N;i++){
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      }
      int R = 0;
      boolean re=false;
      for(int i = 0;i<N;i++){
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      }
                         if(re){
                           System.out.println("Yes");
                         }else{
                           System.out.println("No");
                         }
   }
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);     
      int N = sc.nextInt();
      boolean[] J = new boolean[N];
      int[] D1 = new int[N];
      int[] D2 = new int[N];
      for(int i = 0;i<N;i++){
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      }
      int R = 0;
      boolean re=false;
      for(int i = 0;i<N;i++){
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      }
                         if(re){
                           System.out.println("Yes");
                         }else{
                           System.out.println("No");
                         }
   }
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);     
      int N = sc.nextInt();
      boolean[] J = new boolean[N];
      int[] D1 = new int[N];
      int[] D2 = new int[N];
      for(int i = 0;i<N;i++){
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      }
      int R = 0;
      boolean re=false;
      for(int i = 0;i<N;i++){
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      }
                         if(re){
                           System.out.println("Yes");
                         }else{
                           System.out.println("No");
                         }
   } main {
		Scanner sc = new Scanner(System.in);     
      int N = sc.nextInt();
      boolean[] J = new boolean[N];
      int[] D1 = new int[N];
      int[] D2 = new int[N];
      for(int i = 0;i<N;i++){
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      }
      int R = 0;
      boolean re=false;
      for(int i = 0;i<N;i++){
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      }
                         if(re){
                           System.out.println("Yes");
                         }else{
                           System.out.println("No");
                         }
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc boolean[] J = new boolean[N]; J new boolean[N] N int[] D1 = new int[N]; D1 new int[N] N int[] D2 = new int[N]; D2 new int[N] N for(int i = 0;i<N;i++){
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      } int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      } {
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      } D1[i]=sc.nextInt() D1[i] D1 i sc.nextInt() sc.nextInt sc D2[i]=sc.nextInt() D2[i] D2 i sc.nextInt() sc.nextInt sc J[i]=D1[i]==D2[i] J[i] J i D1[i]==D2[i] D1[i] D1 i D2[i] D2 i int R = 0; R 0 boolean re=false; re false for(int i = 0;i<N;i++){
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      } int i = 0; int i = 0; i 0 i<N i N i++ i++ i {
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      } {
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      } if(J[i]){
          R++;
        }else{
          R=0;
        } J[i] J i {
          R++;
        } R++ R {
          R=0;
        } R=0 R 0 if(R>2){
          re=true;
          break;
        } R>2 R 2 {
          re=true;
          break;
        } re=true re true break; if(re){
                           System.out.println("Yes");
                         }else{
                           System.out.println("No");
                         } re {
                           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
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);     
      int N = sc.nextInt();
      boolean[] J = new boolean[N];
      int[] D1 = new int[N];
      int[] D2 = new int[N];
      for(int i = 0;i<N;i++){
        D1[i]=sc.nextInt();
        D2[i]=sc.nextInt();
        J[i]=D1[i]==D2[i];
      }
      int R = 0;
      boolean re=false;
      for(int i = 0;i<N;i++){
        if(J[i]){
          R++;
        }else{
          R=0;
        }
        if(R>2){
          re=true;
          break;
        }
      }
                         if(re){
                           System.out.println("Yes");
                         }else{
                           System.out.println("No");
                         }
   }
}