import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			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 a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} 
		
		
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} 
		
		
	} main {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} 
		
		
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = 0; b 0 boolean c = false; c false int[] d = new int[a]; d new int[a] a int[] e = new int[a]; e new int[a] a for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		} int i = 0; int i = 0; i 0 i < a i a i++ i++ i {
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		} {
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		} d[i] = sc.nextInt() d[i] d i sc.nextInt() sc.nextInt sc e[i] = sc.nextInt() e[i] e i sc.nextInt() sc.nextInt sc if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			} d[i] == e[i] d[i] d i e[i] e i {
				b++;
				if(b == 3){
					c = true;
				}
			} b++ b if(b == 3){
					c = true;
				} b == 3 b 3 {
					c = true;
				} c = true c true {
				b = 0;
			} b = 0 b 0 if(c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} c {
			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 a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			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 a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			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 a = sc.nextInt();
		int b = 0;
		boolean c = false;
		// 文字列の入力
		int[] d = new int[a];
		int[] e = new int[a];
		for(int i = 0; i < a; i++){
			d[i] = sc.nextInt();
			e[i] = sc.nextInt();
			if(d[i] == e[i]){
				b++;
				if(b == 3){
					c = true;
				}
			}else{
				b = 0;
			}
		}
		if(c){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		} 
		
		
	}
}