import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
    public static String function(int [][]arr){
        for(int i = 0; i < arr.length - 2; i++){
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        }
      return "No";
    }
    
	public static void main (String[] args) throws java.lang.Exception
	{
	    try{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    }
	    catch( Exception e){
	        return ;
	    }
	}
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java class Main
{
    public static String function(int [][]arr){
        for(int i = 0; i < arr.length - 2; i++){
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        }
      return "No";
    }
    
	public static void main (String[] args) throws java.lang.Exception
	{
	    try{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    }
	    catch( Exception e){
	        return ;
	    }
	}
} Main public static String function(int [][]arr){
        for(int i = 0; i < arr.length - 2; i++){
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        }
      return "No";
    } function {
        for(int i = 0; i < arr.length - 2; i++){
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        }
      return "No";
    } for(int i = 0; i < arr.length - 2; i++){
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        } int i = 0; int i = 0; i 0 i < arr.length - 2 i arr.length - 2 arr.length arr arr.length 2 i++ i++ i {
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        } {
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        } if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes"; arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1] arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1] arr[i][0] == arr[i][1] arr[i][0] arr[i] arr i 0 arr[i][1] arr[i] arr i 1 arr[i + 1][0] == arr[i + 1][1] arr[i + 1][0] arr[i + 1] arr i + 1 i 1 0 arr[i + 1][1] arr[i + 1] arr i + 1 i 1 1 arr[i + 2][0] == arr[i +  2][1] arr[i + 2][0] arr[i + 2] arr i + 2 i 2 0 arr[i +  2][1] arr[i +  2] arr i +  2 i 2 1 return "Yes"; "Yes" return "No"; "No" int [][]arr arr public static void main (String[] args) throws java.lang.Exception
	{
	    try{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    }
	    catch( Exception e){
	        return ;
	    }
	} main {
	    try{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    }
	    catch( Exception e){
	        return ;
	    }
	} try{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    }
	    catch( Exception e){
	        return ;
	    } catch( Exception e){
	        return ;
	    } Exception e {
	        return ;
	    } return ; {
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    } BufferedReader reader=new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int T= Integer.parseInt(reader.readLine()); T Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int [][]arr = new int[T][2]; arr new int[T][2] T 2 for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		} int i = 0; int i = 0; i 0 i < T i T i++ i++ i {
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		} {
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		} String []str=reader.readLine().split(" "); str reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " arr[i][0]=Integer.parseInt(str[0]) arr[i][0] arr[i] arr i 0 Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 arr[i][1]=Integer.parseInt(str[1]) arr[i][1] arr[i] arr i 1 Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 System.out.println(function(arr)) System.out.println System.out System System.out function(arr) function arr String[] args args
import java.util.*;
import java.lang.*;
import java.io.*;
class Main
{
    public static String function(int [][]arr){
        for(int i = 0; i < arr.length - 2; i++){
          if(arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i +  2][1])
            return "Yes";
        }
      return "No";
    }
    
	public static void main (String[] args) throws java.lang.Exception
	{
	    try{
		BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
		int T= Integer.parseInt(reader.readLine());
        int [][]arr = new int[T][2];
		for(int i = 0; i < T; i++){
		    String []str=reader.readLine().split(" ");
		    arr[i][0]=Integer.parseInt(str[0]);
		    arr[i][1]=Integer.parseInt(str[1]);
		}
        System.out.println(function(arr));
	    }
	    catch( Exception e){
	        return ;
	    }
	}
}