import java.util.*;
public class Main{
  public static void main(String[] args){
  	Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) 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);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) System.out.println("Yes");
    else System.out.println("No");
  }
} Main public static void main(String[] args){
  	Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) System.out.println("Yes");
    else System.out.println("No");
  } main {
  	Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) System.out.println("Yes");
    else System.out.println("No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int[][] t = new int[d][2]; t new int[d][2] d 2 for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    } int i=0; int i=0; i 0 i<d i d i++ i++ i {
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    } {
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    } t[i][0] = sc.nextInt() t[i][0] t[i] t i 0 sc.nextInt() sc.nextInt sc t[i][1] = sc.nextInt() t[i][1] t[i] t i 1 sc.nextInt() sc.nextInt sc boolean flag = false; flag false for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    } int i=0; int i=0; i 0 i<d-2 i d-2 d 2 i++ i++ i {
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    } {
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    } if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true; t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1] t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1] t[i][0] == t[i][1] t[i][0] t[i] t i 0 t[i][1] t[i] t i 1 t[i+1][0] == t[i+1][1] t[i+1][0] t[i+1] t i+1 i 1 0 t[i+1][1] t[i+1] t i+1 i 1 1 t[i+2][0] == t[i+2][1] t[i+2][0] t[i+2] t i+2 i 2 0 t[i+2][1] t[i+2] t i+2 i 2 1 flag = true flag true if(flag) System.out.println("Yes");
    else System.out.println("No"); flag 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);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) System.out.println("Yes");
    else System.out.println("No");
  }
} public class Main{
  public static void main(String[] args){
  	Scanner sc = new Scanner(System.in);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) 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);
    int d = sc.nextInt();
    int[][] t = new int[d][2];
    for(int i=0;i<d;i++){
    	t[i][0] = sc.nextInt();
      	t[i][1] = sc.nextInt();
    }
    boolean flag = false;
    for(int i=0;i<d-2;i++){
    	if(t[i][0] == t[i][1] && t[i+1][0] == t[i+1][1] && t[i+2][0] == t[i+2][1]) flag = true;
    }
    if(flag) System.out.println("Yes");
    else System.out.println("No");
  }
}