import java.io.*;
import java.util.*;
import java.math.*;
 
public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }
 
     long nextLong(){
          return Long.parseLong(next());
     }
 
     double nextDouble(){
          return Double.parseDouble(next());
     }

     String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
 
 }  
   
    static  Fast f=new Fast();
    static PrintWriter out = new PrintWriter(System.out);


    static void readArray(int a[]) 
      {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      }
    
    
     
  public static void main(String[] args)throws Exception{
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
}
} import java.io.*; io.* java import java.util.*; util.* java import java.math.*; math.* java public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }
 
     long nextLong(){
          return Long.parseLong(next());
     }
 
     double nextDouble(){
          return Double.parseDouble(next());
     }

     String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
 
 }  
   
    static  Fast f=new Fast();
    static PrintWriter out = new PrintWriter(System.out);


    static void readArray(int a[]) 
      {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      }
    
    
     
  public static void main(String[] args)throws Exception{
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
}
} Main static  Fast f=new Fast(); f new Fast() static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) static void readArray(int a[]) 
      {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      } readArray {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      } for (int i=0;i<a.length;i++ ) a[i]=f.nextInt(); int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i a[i]=f.nextInt(); a[i]=f.nextInt() a[i] a i f.nextInt() f.nextInt f int a[] a public static void main(String[] args)throws Exception{
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
} main {
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
} int n=f.nextInt(); n f.nextInt() f.nextInt f 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]=f.nextInt();
            d2[i]=f.nextInt();
          } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          } {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          } d1[i]=f.nextInt() d1[i] d1 i f.nextInt() f.nextInt f d2[i]=f.nextInt() d2[i] d2 i f.nextInt() f.nextInt f int count=0; count 0 for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          } {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          } if (count==3) {
              break;
            } count==3 count 3 {
              break;
            } break; if (d1[i]==d2[i]) {
              count++;
              continue;
            } d1[i]==d2[i] d1[i] d1 i d2[i] d2 i {
              count++;
              continue;
            } count++ count continue; count=0 count 0 if (count==3)
          out.println("Yes");
          else 
          out.println("No"); count==3 count 3 out.println("Yes") out.println out "Yes" out.println("No") out.println out "No" out.close() out.close out String[] args args static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }
 
     long nextLong(){
          return Long.parseLong(next());
     }
 
     double nextDouble(){
          return Double.parseDouble(next());
     }

     String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
 
 } Fast public BufferedReader br; br public StringTokenizer st; st public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     } Fast {
          br =new BufferedReader(new InputStreamReader(System.in));
     } br =new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          } next {
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          } while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          } st==null || !st.hasMoreTokens() st==null st null !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st {
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          } try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               } catch(IOException e){
                    throw new RuntimeException(e);
               } IOException e {
                    throw new RuntimeException(e);
               } throw new RuntimeException(e); new RuntimeException(e) {
                    st=new StringTokenizer(br.readLine());
               } st=new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt(){
          return Integer.parseInt(next());
     } nextInt {
          return Integer.parseInt(next());
     } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next long nextLong(){
          return Long.parseLong(next());
     } nextLong {
          return Long.parseLong(next());
     } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble(){
          return Double.parseDouble(next());
     } nextDouble {
          return Double.parseDouble(next());
     } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } nextLine { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } String str = ""; str "" try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } catch (IOException e) 
            { 
                e.printStackTrace(); 
            } IOException e { 
                e.printStackTrace(); 
            } e.printStackTrace() e.printStackTrace e { 
                str = br.readLine(); 
            } str = br.readLine() str br.readLine() br.readLine br return str; str public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }
 
     long nextLong(){
          return Long.parseLong(next());
     }
 
     double nextDouble(){
          return Double.parseDouble(next());
     }

     String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
 
 }  
   
    static  Fast f=new Fast();
    static PrintWriter out = new PrintWriter(System.out);


    static void readArray(int a[]) 
      {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      }
    
    
     
  public static void main(String[] args)throws Exception{
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
}
} public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }
 
     long nextLong(){
          return Long.parseLong(next());
     }
 
     double nextDouble(){
          return Double.parseDouble(next());
     }

     String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
 
 }  
   
    static  Fast f=new Fast();
    static PrintWriter out = new PrintWriter(System.out);


    static void readArray(int a[]) 
      {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      }
    
    
     
  public static void main(String[] args)throws Exception{
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
}
} Main
import java.io.*;
import java.util.*;
import java.math.*;
 
public class Main{ 
   static class Fast{
     public BufferedReader br;
     public StringTokenizer st;
     
     public Fast(){
          br =new BufferedReader(new InputStreamReader(System.in));
     }
     
     String next(){
          while(st==null || !st.hasMoreTokens()){
               try{
                    st=new StringTokenizer(br.readLine());
               }
               catch(IOException e){
                    throw new RuntimeException(e);
               }
               
          }
               return st.nextToken();
          }
     int nextInt(){
          return Integer.parseInt(next());
     }
 
     long nextLong(){
          return Long.parseLong(next());
     }
 
     double nextDouble(){
          return Double.parseDouble(next());
     }

     String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
 
 }  
   
    static  Fast f=new Fast();
    static PrintWriter out = new PrintWriter(System.out);


    static void readArray(int a[]) 
      {
        
        for (int i=0;i<a.length;i++ ) a[i]=f.nextInt();
        
      }
    
    
     
  public static void main(String[] args)throws Exception{
  //StringTokenizer st;//! @ % & * () _ {} # ~ : < > ? "" | ^
         
 
        //StringBuilder res=new StringBuilder();

         int n=f.nextInt();
  
       
       // while(t-->0){
          int d1[]=new int[n];
          int d2[]=new int[n];
          for (int i=0;i<n ;i++ ) {
            d1[i]=f.nextInt();
            d2[i]=f.nextInt();
          }
          
          int count=0;
          for (int i=0;i<n ;i++ ) {
            if (count==3) {
              break;
            }

            if (d1[i]==d2[i]) {
              count++;
              continue;
            }

            count=0;

          }

          
      //  }
          if (count==3)
          out.println("Yes");
          else 
          out.println("No");

   
        

        out.close();
 
}
}