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