import java.util.*;
import java.io.*;

public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	

	public static void main(String[] args) {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	}

	static void solve() {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		}

		int  nextInt() {
			return Integer.parseInt(next());
		}
	}
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	

	public static void main(String[] args) {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	}

	static void solve() {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		}

		int  nextInt() {
			return Integer.parseInt(next());
		}
	}
} Main static FastReader f = new FastReader(); f new FastReader() static PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	} main {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	} solve() solve out.close() out.close out String[] args args static void solve() {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	} solve {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	} int n = f.nextInt(); n f.nextInt() f.nextInt f int max = 0 max 0 cur = 0; cur 0 while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		} n-- > 0 n-- n 0 {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		} int a = f.nextInt() a f.nextInt() f.nextInt f b = f.nextInt(); b f.nextInt() f.nextInt f if(a == b) {
				cur++;
			} else {
				cur = 0;
			} a == b a b {
				cur++;
			} cur++ cur {
				cur = 0;
			} cur = 0 cur 0 max = Math.max(cur, max) max Math.max(cur, max) Math.max Math cur max out.println(max >= 3 ? "Yes" : "No") out.println out max >= 3 ? "Yes" : "No" max >= 3 max 3 "Yes" "No" static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		}

		int  nextInt() {
			return Integer.parseInt(next());
		}
	} FastReader BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st; st String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		} next {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		} while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			} st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			} try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				} catch(IOException ioe) {
					ioe.printStackTrace();
				} IOException ioe {
					ioe.printStackTrace();
				} ioe.printStackTrace() ioe.printStackTrace ioe {
					st = new StringTokenizer(br.readLine());
				} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		} nextLine {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		} String s = ""; s "" try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			} IOException ioe {
				ioe.printStackTrace();
			} ioe.printStackTrace() ioe.printStackTrace ioe {
				s = br.readLine();
			} s = br.readLine() s br.readLine() br.readLine br return s; s int  nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	

	public static void main(String[] args) {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	}

	static void solve() {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		}

		int  nextInt() {
			return Integer.parseInt(next());
		}
	}
} public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	

	public static void main(String[] args) {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	}

	static void solve() {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		}

		int  nextInt() {
			return Integer.parseInt(next());
		}
	}
} Main
import java.util.*;
import java.io.*;

public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	

	public static void main(String[] args) {
		//int t = f.nextInt();
		//while(t-- > 0)
			solve();
		out.close();
	}

	static void solve() {
		int n = f.nextInt();
		int max = 0, cur = 0;
		while(n-- > 0) {
			int a = f.nextInt(), b = f.nextInt();
			if(a == b) {
				cur++;
			} else {
				cur = 0;
			}
			max = Math.max(cur, max);
		}

		out.println(max >= 3 ? "Yes" : "No");
	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException ioe) {
					ioe.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String s = "";
			try {
				s = br.readLine();
			} catch(IOException ioe) {
				ioe.printStackTrace();
			}

			return s;
		}

		int  nextInt() {
			return Integer.parseInt(next());
		}
	}
}