import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	}
} import java.util.*; util.* java public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	}
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	} main {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int old ; old boolean ans = false; ans false int count = 0; count 0 for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		} int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		} {
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		} int d_1 = scan.nextInt(); d_1 scan.nextInt() scan.nextInt scan int d_2 = scan.nextInt(); d_2 scan.nextInt() scan.nextInt scan if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			} d_1 == d_2 d_1 d_2 {
				count++;
				if(count == 3) ans = true;
			} count++ count if(count == 3) ans = true; count == 3 count 3 ans = true ans true {
				count = 0;
			} count = 0 count 0 System.out.print(ans?"Yes":"No") System.out.print System.out System System.out ans?"Yes":"No" ans "Yes" "No" String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	}
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	}
} Main
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int old ;
		boolean ans = false;
		int count = 0;
		for(int i = 0;i < n;++i){
			int d_1 = scan.nextInt();
			int d_2 = scan.nextInt();

			if (d_1 == d_2){
				count++;
				if(count == 3) ans = true;
			}else{
				count = 0;
			}
		}
		System.out.print(ans?"Yes":"No");

	}
}
