import java.io.*;
import java.util.*;
class Main
{
	 public static void  main (String[] args) throws IOException
    {
       try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	}
    catch(Exception e){}
}} import java.io.*; io.* java import java.util.*; util.* java class Main
{
	 public static void  main (String[] args) throws IOException
    {
       try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	}
    catch(Exception e){}
}} Main public static void  main (String[] args) throws IOException
    {
       try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	}
    catch(Exception e){}
} main {
       try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	}
    catch(Exception e){}
} try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	}
    catch(Exception e){} catch(Exception e){} Exception e {} {
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	} BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int a=0; a 0 a=Integer.parseInt(br.readLine()) a Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int n[][]=new int[a][2]; n new int[a][2] a 2 for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	} int i=0; int i=0; i 0 i<n.length i n.length n n.length i++ i++ i {
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	} {
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	} String c[]=br.readLine().split(" "); c br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " n[i][0]=Integer.parseInt(c[0]) n[i][0] n[i] n i 0 Integer.parseInt(c[0]) Integer.parseInt Integer c[0] c 0 n[i][1]=Integer.parseInt(c[1]) n[i][1] n[i] n i 1 Integer.parseInt(c[1]) Integer.parseInt Integer c[1] c 1 boolean b=false; b false for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	} int i=0; int i=0; i 0 i<n.length-2 i n.length-2 n.length n n.length 2 i++ i++ i {
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	} {
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	} if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		} n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1] n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1] n[i][0]==n[i][1] n[i][0] n[i] n i 0 n[i][1] n[i] n i 1 n[i+1][0]==n[i+1][1] n[i+1][0] n[i+1] n i+1 i 1 0 n[i+1][1] n[i+1] n i+1 i 1 1 n[i+2][0]==n[i+2][1] n[i+2][0] n[i+2] n i+2 i 2 0 n[i+2][1] n[i+2] n i+2 i 2 1 {
       			System.out.println("Yes");
       			b=true;
       			break;
       		} System.out.println("Yes") System.out.println System.out System System.out "Yes" b=true b true break; if(b==false)
       	{
       		System.out.println("No");
       	} b==false b false {
       		System.out.println("No");
       	} System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.*;
import java.util.*;
class Main
{
	 public static void  main (String[] args) throws IOException
    {
       try{
       BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
       int a=0;
       a=Integer.parseInt(br.readLine());
       	int n[][]=new int[a][2];
       	for(int i=0;i<n.length;i++)
       	{
       	  String c[]=br.readLine().split(" ");
           n[i][0]=Integer.parseInt(c[0]);
           n[i][1]=Integer.parseInt(c[1]);
       	}
       	boolean b=false;
       	for(int i=0;i<n.length-2;i++)
       	{
       		if(n[i][0]==n[i][1]&&n[i+1][0]==n[i+1][1]&&n[i+2][0]==n[i+2][1])
       		{
       			System.out.println("Yes");
       			b=true;
       			break;
       		}
       	}
       	if(b==false)
       	{
       		System.out.println("No");
       	}
       	}
    catch(Exception e){}
}}
