import java.util.*;
public class Main {
  public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  }
} import java.util.*; util.* java public class Main {
  public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  }
} Main public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  } main {
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) boolean result = false; result false int trial_num = sc.nextInt(); trial_num sc.nextInt() sc.nextInt sc int[][] combi = new int[trial_num][2]; combi new int[trial_num][2] trial_num 2 for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    } int i = 0; int i = 0; i 0 i < trial_num i trial_num i++ i++ i {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    } {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    } for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        } int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
        	combi[i][j] = sc.nextInt();
        } {
        	combi[i][j] = sc.nextInt();
        } combi[i][j] = sc.nextInt() combi[i][j] combi[i] combi i j sc.nextInt() sc.nextInt sc for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    } int i = 0; int i = 0; i 0 i < trial_num - 2 i trial_num - 2 trial_num 2 i++ i++ i {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    } {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    } if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true; combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1] combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1] combi[i][0] == combi[i][1] combi[i][0] combi[i] combi i 0 combi[i][1] combi[i] combi i 1 combi[i+1][0] == combi[i+1][1] combi[i+1][0] combi[i+1] combi i+1 i 1 0 combi[i+1][1] combi[i+1] combi i+1 i 1 1 combi[i+2][0] == combi[i+2][1] combi[i+2][0] combi[i+2] combi i+2 i 2 0 combi[i+2][1] combi[i+2] combi i+2 i 2 1 result = true result true if(result) System.out.println("Yes");
    else System.out.println("No"); result System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
  public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  }
} public class Main {
  public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  }
} Main
import java.util.*;
public class Main {
  public static void main (String[] args){
	Scanner sc = new Scanner(System.in);
    boolean result = false;
    int trial_num = sc.nextInt();
    int[][] combi = new int[trial_num][2];
    for(int i = 0; i < trial_num; i++) {
		for(int j = 0; j < 2; j++){
        	combi[i][j] = sc.nextInt();
        }
    }
    for(int i = 0; i < trial_num - 2; i++) {
        if(combi[i][0] == combi[i][1] 
           && combi[i+1][0] == combi[i+1][1] && combi[i+2][0] == combi[i+2][1])
     		result = true;
    }
    if(result) System.out.println("Yes");
    else System.out.println("No");
  }
}
