import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws java.lang.Exception{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	}

} import java.util.*; util.* java import java.io.*; io.* java public class Main {

	public static void main(String[] args) throws java.lang.Exception{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	}

} Main public static void main(String[] args) throws java.lang.Exception{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	} main {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n=Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String ans=""; ans "" for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		} {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		} StringTokenizer st = new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int a=Integer.parseInt(st.nextToken()) a Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st b=Integer.parseInt(st.nextToken()); b Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st if(a==b) ans+="1";
			else  ans+="0"; a==b a b ans+="1" ans "1" ans+="0" ans "0" int c=0; c 0 for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		} int i=0; int i=0; i 0 i<ans.length() i ans.length() ans.length ans i++ i++ i {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		} {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		} if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			} ans.charAt(i)=='0' ans.charAt(i) ans.charAt ans i '0' {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			} if(c>=3) {
					System.out.println("Yes");
					return;
				} c>=3 c 3 {
					System.out.println("Yes");
					return;
				} System.out.println("Yes") System.out.println System.out System System.out "Yes" return; c=0 c 0 continue; ++c c System.out.println(c>=3?"Yes":"No") System.out.println System.out System System.out c>=3?"Yes":"No" c>=3 c 3 "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) throws java.lang.Exception{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	}

} public class Main {

	public static void main(String[] args) throws java.lang.Exception{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	}

} Main
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws java.lang.Exception{
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n=Integer.parseInt(br.readLine());
		String ans="";
		for(int i=0; i<n; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int a=Integer.parseInt(st.nextToken()),b=Integer.parseInt(st.nextToken());
			if(a==b) ans+="1";
			else  ans+="0";
		}
		int c=0;
		for(int i=0; i<ans.length(); i++) {
			if(ans.charAt(i)=='0') {
				if(c>=3) {
					System.out.println("Yes");
					return;
				}
				c=0;
				continue;
			}
			++c;
		}
		System.out.println(c>=3?"Yes":"No");
	}

}