import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int n = Integer.parseInt(br.readLine().trim());
      	int count=0;
      	boolean flag = false;
      	for(int i=1;i<=n;i++){
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        }
      	if(!flag && count!=3)
      		System.out.println("No");
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int n = Integer.parseInt(br.readLine().trim());
      	int count=0;
      	boolean flag = false;
      	for(int i=1;i<=n;i++){
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        }
      	if(!flag && count!=3)
      		System.out.println("No");
    }
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int n = Integer.parseInt(br.readLine().trim());
      	int count=0;
      	boolean flag = false;
      	for(int i=1;i<=n;i++){
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        }
      	if(!flag && count!=3)
      		System.out.println("No");
    } main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int n = Integer.parseInt(br.readLine().trim());
      	int count=0;
      	boolean flag = false;
      	for(int i=1;i<=n;i++){
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        }
      	if(!flag && count!=3)
      		System.out.println("No");
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine().trim()); n Integer.parseInt(br.readLine().trim()) Integer.parseInt Integer br.readLine().trim() br.readLine().trim br.readLine() br.readLine br int count=0; count 0 boolean flag = false; flag false for(int i=1;i<=n;i++){
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        } int i=1; int i=1; i 1 i<=n i n i++ i++ i {
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        } {
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        } String s[] = br.readLine().trim().split(" "); s br.readLine().trim().split(" ") br.readLine().trim().split br.readLine().trim() br.readLine().trim br.readLine() br.readLine br " " int a = Integer.parseInt(s[0]); a Integer.parseInt(s[0]) Integer.parseInt Integer s[0] s 0 int b = Integer.parseInt(s[1]); b Integer.parseInt(s[1]) Integer.parseInt Integer s[1] s 1 if(a == b){
				count++;
          }
          else{
            	count=0;
          } a == b a b {
				count++;
          } count++ count {
            	count=0;
          } count=0 count 0 if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          } !flag && count == 3 !flag flag count == 3 count 3 {
            	System.out.println("Yes");
          		flag = true;
          } System.out.println("Yes") System.out.println System.out System System.out "Yes" flag = true flag true if(!flag && count!=3)
      		System.out.println("No"); !flag && count!=3 !flag flag count!=3 count 3 System.out.println("No") System.out.println System.out System System.out "No" String[] args args
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int n = Integer.parseInt(br.readLine().trim());
      	int count=0;
      	boolean flag = false;
      	for(int i=1;i<=n;i++){
          String s[] = br.readLine().trim().split(" ");
          int a = Integer.parseInt(s[0]);
          int b = Integer.parseInt(s[1]);
          if(a == b){
				count++;
          }
          else{
            	count=0;
          }
          if(!flag && count == 3){
            	System.out.println("Yes");
          		flag = true;
          }
        }
      	if(!flag && count!=3)
      		System.out.println("No");
    }
}