import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	}

} import java.util.Scanner; Scanner java.util public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	}

} Main public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	} main {
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int amountToRoll = Integer.parseInt(scan.nextLine()); amountToRoll Integer.parseInt(scan.nextLine()) Integer.parseInt Integer scan.nextLine() scan.nextLine scan int streak = 0; streak 0 for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		} int i = 0; int i = 0; i 0 i < amountToRoll i amountToRoll i++ i++ i {
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		} {
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		} String[] array = scan.nextLine().split("\\s"); array scan.nextLine().split("\\s") scan.nextLine().split scan.nextLine() scan.nextLine scan "\\s" if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			} array[0].equals(array[1]) array[0].equals array[0] array 0 array[1] array 1 {
				streak++;
			} streak++ streak {
				streak = 0;
			} streak = 0 streak 0 if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			} streak == 3 streak 3 {
				System.out.println("Yes");
				break;
			} System.out.println("Yes") System.out.println System.out System System.out "Yes" break; if(streak != 3) 
		{
			System.out.println("No");
		} streak != 3 streak 3 {
			System.out.println("No");
		} System.out.println("No") System.out.println System.out System System.out "No" scan.close() scan.close scan String[] args args public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	}

} public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	}

} Main
import java.util.Scanner;

public class Main
{

	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int amountToRoll = Integer.parseInt(scan.nextLine());
		
		int streak = 0;
		
		for (int i = 0; i < amountToRoll; i++)
		{
			String[] array = scan.nextLine().split("\\s");
			
			if(array[0].equals(array[1])) 
			{
				streak++;
			}
			
			else 
			{
				streak = 0;
			}
			
			if(streak == 3) 
			{
				System.out.println("Yes");
				break;
			}
			
		}
		
		
		
		if(streak != 3) 
		{
			System.out.println("No");
		}
		
		scan.close();

	}

}
