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

public class Main {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	}
	
	static void update(int[][] dp0, int[][] dp, int i, int j) {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	}

	static int toggle(int n) {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	}
	
	static int [][] Grid(int m, int n) {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	}

	public static long powmod(int x, long y, long mod) {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    }
    

    static class Pair {
        int first = 1;
        int second = 2;
    }

    public void fibonacci(int N) {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    }

    public class Solver {
		Solver() {
			
        }
        
    }

    static long factorial(long x) {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    }
    
    static long gcdOfFactorial(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } 
	
	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	}
	
	static void update(int[][] dp0, int[][] dp, int i, int j) {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	}

	static int toggle(int n) {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	}
	
	static int [][] Grid(int m, int n) {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	}

	public static long powmod(int x, long y, long mod) {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    }
    

    static class Pair {
        int first = 1;
        int second = 2;
    }

    public void fibonacci(int N) {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    }

    public class Solver {
		Solver() {
			
        }
        
    }

    static long factorial(long x) {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    }
    
    static long gcdOfFactorial(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } 
	
	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
} Main static final StdIn in = new StdIn(); in new StdIn() static final PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) public static void main(String[] args) {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	} main {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	} int n= in.nextInt(); n in.nextInt() in.nextInt in boolean isok = false; isok false int counter = 0; counter 0 for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		} {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		} int a = in.nextInt(); a in.nextInt() in.nextInt in int b = in.nextInt(); b in.nextInt() in.nextInt in if(a != b) {
				isok = false;
				counter = 0;
				continue;
			} a != b a b {
				isok = false;
				counter = 0;
				continue;
			} isok = false isok false counter = 0 counter 0 continue; isok = true isok true counter++ counter if(counter == 3) {
				break;
			} counter == 3 counter 3 {
				break;
			} break; if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		} isok && counter == 3 isok counter == 3 counter 3 {
			out.println("Yes");
		} out.println("Yes") out.println out "Yes" {
			out.println("No");
		} out.println("No") out.println out "No" out.close() out.close out String[] args args static void update(int[][] dp0, int[][] dp, int i, int j) {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	} update {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	} for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		} int k = i-1; int k = i-1; k i-1 i 1 k <= i+1 k i+1 i 1 k++ k++ k {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		} {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		} for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			} int k2 = j-1; int k2 = j-1; k2 j-1 j 1 k2 <= j+1 k2 j+1 j 1 k2++ k2++ k2 {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			} {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			} if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				} k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2 k2 >= 0 k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2 k >= 0 k 0 k <= 2 k 2 k2 >= 0 k2 0 k2 <= 2 k2 2 {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				} if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					} dp0[k][k2] == 1 dp0[k][k2] dp0[k] dp0 k k2 1 {
						dp[k][k2] = toggle(dp[k][k2]);
					} dp[k][k2] = toggle(dp[k][k2]) dp[k][k2] dp[k] dp k k2 toggle(dp[k][k2]) toggle dp[k][k2] dp[k] dp k k2 if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					} k2 == j+1 k2 j+1 j 1 {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} dp[k][k2] = toggle(dp[k][k2]) dp[k][k2] dp[k] dp k k2 toggle(dp[k][k2]) toggle dp[k][k2] dp[k] dp k k2 {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					} dp[k][k2]= toggle(dp[k][k2]) dp[k][k2] dp[k] dp k k2 toggle(dp[k][k2]) toggle dp[k][k2] dp[k] dp k k2 int[][] dp0 dp0 int[][] dp dp int i i int j j static int toggle(int n) {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	} toggle {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	} if(n%2==0) {
			return 1;
		} else {
			return 0;
		} n%2==0 n%2 n 2 0 {
			return 1;
		} return 1; 1 {
			return 0;
		} return 0; 0 int n n static int [][] Grid(int m, int n) {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	} Grid {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	} int [][]dp = new int[m][n]; dp new int[m][n] m n for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		} int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		} {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		} for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			} int j = 0; int j = 0; j 0 j < n j n j++ j++ j {
				dp[i][j] = in.nextInt();
			} {
				dp[i][j] = in.nextInt();
			} dp[i][j] = in.nextInt() dp[i][j] dp[i] dp i j in.nextInt() in.nextInt in return dp; dp int m m int n n public static long powmod(int x, long y, long mod) {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    } powmod {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    } long total = 1; total 1 for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        } long i = 0; long i = 0; i 0 i < y i y i++ i++ i {
            total = (total * x) % mod;
        } {
            total = (total * x) % mod;
        } total = (total * x) % mod total (total * x) % mod (total * x) total x mod return total; total int x x long y y long mod mod public void fibonacci(int N) {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    } fibonacci {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    } boolean arr[] = new boolean[N]; arr new boolean[N] N Arrays.fill(arr, false) Arrays.fill Arrays arr false arr[0] = true arr[0] arr 0 true if(N>1)
            arr[1] = true; N>1 N 1 arr[1] = true arr[1] arr 1 true Pair p = new Pair(); p new Pair() for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        } int i = 3; int i = 3; i 3 i <= N i N i++ i++ i {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        } {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        } if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            } p.first + p.second == i p.first + p.second p.first p p.first p.second p p.second i {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } arr[i-1] = true arr[i-1] arr i-1 i 1 true p.first = p.second p.first p p.first p.second p p.second p.second = i p.second p p.second i {
                arr[i-1] = false;
            } arr[i-1] = false arr[i-1] arr i-1 i 1 false int N N static long factorial(long x) {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    } factorial {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    } if(x <= 1) {
            return 1;
        } x <= 1 x 1 {
            return 1;
        } return 1; 1 long res = 2; res 2 for (int i = 3; i <= x; i++) {
            res = res * i;
        } int i = 3; int i = 3; i 3 i <= x i x i++ i++ i {
            res = res * i;
        } {
            res = res * i;
        } res = res * i res res * i res i return res; res long x x static long gcdOfFactorial(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } gcdOfFactorial { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } if (b == 0) 
            return a; b == 0 b 0 return a; a return gcdOfFactorial(b, a % b); gcdOfFactorial(b, a % b) gcdOfFactorial b a % b a b long a a long b b static class Pair {
        int first = 1;
        int second = 2;
    } Pair int first = 1; first 1 int second = 2; second 2 public class Solver {
		Solver() {
			
        }
        
    } Solver Solver() {
			
        } Solver {
			
        } static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	} StdIn final private int BUFFER_SIZE = 1 << 16; BUFFER_SIZE 1 << 16 1 16 private DataInputStream din; din private byte[] buffer; buffer private int bufferPointer bufferPointer bytesRead; bytesRead public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		} StdIn {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		} din = new DataInputStream(System.in) din new DataInputStream(System.in) buffer = new byte[BUFFER_SIZE] buffer new byte[BUFFER_SIZE] BUFFER_SIZE bufferPointer = bytesRead = 0 bufferPointer bytesRead = 0 bytesRead 0 public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		} StdIn {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		} try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			} catch(Exception e) {
				throw new RuntimeException();
			} Exception e {
				throw new RuntimeException();
			} throw new RuntimeException(); new RuntimeException() {
				din = new DataInputStream(in);
			} din = new DataInputStream(in) din new DataInputStream(in) buffer = new byte[BUFFER_SIZE] buffer new byte[BUFFER_SIZE] BUFFER_SIZE bufferPointer = bytesRead = 0 bufferPointer bytesRead = 0 bytesRead 0 InputStream in in public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		} next {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		} int c; c while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r')); (c=read())!=-1&&(c==' '||c=='\n'||c=='\r') (c=read())!=-1 (c=read()) c read() read -1 1 (c==' '||c=='\n'||c=='\r') c==' '||c=='\n'||c=='\r' c==' ' c ' ' c=='\n' c '\n' c=='\r' c '\r' StringBuilder s = new StringBuilder(); s new StringBuilder() while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			} c != -1 c -1 1 {
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			} if (c == ' ' || c == '\n'||c=='\r')
					break; c == ' ' || c == '\n'||c=='\r' c == ' ' || c == '\n'||c=='\r' c == ' ' c ' ' c == '\n' c '\n' c=='\r' c '\r' break; s.append((char)c) s.append s (char)c c=read() c read() read return s.toString(); s.toString() s.toString s public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		} nextLine {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		} int c; c while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r')); (c=read())!=-1&&(c==' '||c=='\n'||c=='\r') (c=read())!=-1 (c=read()) c read() read -1 1 (c==' '||c=='\n'||c=='\r') c==' '||c=='\n'||c=='\r' c==' ' c ' ' c=='\n' c '\n' c=='\r' c '\r' StringBuilder s = new StringBuilder(); s new StringBuilder() while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			} c != -1 c -1 1 {
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			} if (c == '\n'||c=='\r')
					break; c == '\n'||c=='\r' c == '\n' c '\n' c=='\r' c '\r' break; s.append((char)c) s.append s (char)c c = read() c read() read return s.toString(); s.toString() s.toString s public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		} nextInt {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		} int ret = 0; ret 0 byte c = read(); c read() read while (c <= ' ')
				c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg)
				c = read(); neg c = read() c read() read do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (neg)
				return -ret; neg return -ret; -ret ret return ret; ret public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		} readIntArray {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		} int[] ar = new int[n]; ar new int[n] n for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os; int i=0; int i=0; i 0 i<n i n ++i ++i i ar[i]=nextInt()+os; ar[i]=nextInt()+os ar[i] ar i nextInt()+os nextInt() nextInt os return ar; ar int n n int os os public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		} nextLong {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		} long ret = 0; ret 0 byte c = read(); c read() read while (c <= ' ')
				c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg)
				c = read(); neg c = read() c read() read do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (neg)
				return -ret; neg return -ret; -ret ret return ret; ret public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		} readLongArray {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		} long[] ar = new long[n]; ar new long[n] n for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os; int i=0; int i=0; i 0 i<n i n ++i ++i i ar[i]=nextLong()+os; ar[i]=nextLong()+os ar[i] ar i nextLong()+os nextLong() nextLong os return ar; ar int n n long os os public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		} nextDouble {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		} double ret = 0 ret 0 div = 1; div 1 byte c = read(); c read() read while (c <= ' ')
				c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg)
				c = read(); neg c = read() c read() read do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10); c == '.' c '.' while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' ret += (c - '0') / (div *= 10) ret (c - '0') / (div *= 10) (c - '0') c '0' (div *= 10) div 10 if (neg)
				return -ret; neg return -ret; -ret ret return ret; ret private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		} fillBuffer {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		} bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE) bytesRead din.read(buffer, bufferPointer = 0, BUFFER_SIZE) din.read din buffer bufferPointer = 0 bufferPointer 0 BUFFER_SIZE if (bytesRead == -1)
				buffer[0] = -1; bytesRead == -1 bytesRead -1 1 buffer[0] = -1 buffer[0] buffer 0 -1 1 private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		} read {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		} try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			} catch(IOException e) {
				throw new RuntimeException();
			} IOException e {
				throw new RuntimeException();
			} throw new RuntimeException(); new RuntimeException() {
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} if (bufferPointer == bytesRead)
					fillBuffer(); bufferPointer == bytesRead bufferPointer bytesRead fillBuffer() fillBuffer return buffer[bufferPointer++]; buffer[bufferPointer++] buffer bufferPointer++ bufferPointer public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		} close {
			if (din == null)
				return;
			din.close();
		} if (din == null)
				return; din == null din null return; din.close() din.close din public class Main {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	}
	
	static void update(int[][] dp0, int[][] dp, int i, int j) {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	}

	static int toggle(int n) {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	}
	
	static int [][] Grid(int m, int n) {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	}

	public static long powmod(int x, long y, long mod) {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    }
    

    static class Pair {
        int first = 1;
        int second = 2;
    }

    public void fibonacci(int N) {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    }

    public class Solver {
		Solver() {
			
        }
        
    }

    static long factorial(long x) {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    }
    
    static long gcdOfFactorial(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } 
	
	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
} public class Main {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	}
	
	static void update(int[][] dp0, int[][] dp, int i, int j) {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	}

	static int toggle(int n) {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	}
	
	static int [][] Grid(int m, int n) {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	}

	public static long powmod(int x, long y, long mod) {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    }
    

    static class Pair {
        int first = 1;
        int second = 2;
    }

    public void fibonacci(int N) {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    }

    public class Solver {
		Solver() {
			
        }
        
    }

    static long factorial(long x) {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    }
    
    static long gcdOfFactorial(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } 
	
	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
} Main
import java.io.*;
import java.util.*;

public class Main {
	static final StdIn in = new StdIn();
	static final PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		int n= in.nextInt();
		boolean isok = false;
		int counter = 0;
		for (int i = 0; i < n; i++) {
			int a = in.nextInt();
			int b = in.nextInt();
			if(a != b) {
				isok = false;
				counter = 0;
				continue;
			}
			isok = true;
			counter++;
			if(counter == 3) {
				break;
			}
		}
		
        if(isok && counter == 3) {
			out.println("Yes");
		} else {
			out.println("No");
		}
		out.close();
	}
	
	static void update(int[][] dp0, int[][] dp, int i, int j) {
		//(i-1, j-1), (i-1, j), (i-1, j+1)
		//(i, j-1), (i, j), (i, j+1)
		//(i+1, j-1), (i+1, j), (i+1, j+1)

		//(i-1 or j-1) should not be lesser than 0
		//(i+1 or j+1) should not be greater than 2

		//difference between (i or j) and its inc or dec should not cross 2

		for (int k = i-1; k <= i+1; k++) {
			for (int k2 = j-1; k2 <= j+1; k2++) {
				
				if(k >= 0 && k <= 2 && k2 >= 0 && k2 <= 2) {
					//valid
					if(dp0[k][k2] == 1) {
						dp[k][k2] = toggle(dp[k][k2]);
					}
					if(k2 == j+1) {
						// out.println("("+k+","+k2+")=>"+dp[k][k2]);
						dp[k][k2] = toggle(dp[k][k2]);
					} else {
						// out.print("("+k+","+k2+")=>"+dp[k][k2]+",");
						dp[k][k2]= toggle(dp[k][k2]);
					}
				}
			}
		}

// 		(I, j-1), (I, j+1), const I , change in j
// (I+1, j-1), (I+1, j+1), change 1 (+ve), change in j
// (I-1, j-1), (I-1, j+1), change 1 (-ve), change in j
// (I-1, j), (I+1, j)  change in I, const j

	}

	static int toggle(int n) {
		if(n%2==0) {
			return 1;
		} else {
			return 0;
		}
	}
	
	static int [][] Grid(int m, int n) {
		int [][]dp = new int[m][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				dp[i][j] = in.nextInt();
			}
		}
		return dp;
	}

	public static long powmod(int x, long y, long mod) {
        long total = 1;
        for (long i = 0; i < y; i++) {
            total = (total * x) % mod;
        }
        return total;
 
    }
    

    static class Pair {
        int first = 1;
        int second = 2;
    }

    public void fibonacci(int N) {
        boolean arr[] = new boolean[N];
        Arrays.fill(arr, false);
        arr[0] = true;
        if(N>1)
            arr[1] = true;

        Pair p = new Pair();
        for (int i = 3; i <= N; i++) {
            
            if(p.first + p.second == i) {
                arr[i-1] = true;
                p.first = p.second;
                p.second = i;
            } else {
                arr[i-1] = false;
            }
        }
    }

    public class Solver {
		Solver() {
			
        }
        
    }

    static long factorial(long x) {
        if(x <= 1) {
            return 1;
        }
        long res = 2;
        for (int i = 3; i <= x; i++) {
            res = res * i;
        }
        return res;
    }
    
    static long gcdOfFactorial(long a, long b) { 
        if (b == 0) 
            return a; 
        return gcdOfFactorial(b, a % b);
    } 
	
	static class StdIn {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		public StdIn() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public StdIn(InputStream in) {
			try{
				din = new DataInputStream(in);
			} catch(Exception e) {
				throw new RuntimeException();
			}
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}
		public String next() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == ' ' || c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c=read();
			}
			return s.toString();
		}
		public String nextLine() {
			int c;
			while((c=read())!=-1&&(c==' '||c=='\n'||c=='\r'));
			StringBuilder s = new StringBuilder();
			while (c != -1)
			{
				if (c == '\n'||c=='\r')
					break;
				s.append((char)c);
				c = read();
			}
			return s.toString();
		}
		public int nextInt() {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}
		public int[] readIntArray(int n, int os) {
			int[] ar = new int[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextInt()+os;
			return ar;
		}
		public long nextLong() {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}
		public long[] readLongArray(int n, long os) {
			long[] ar = new long[n];
			for(int i=0; i<n; ++i)
				ar[i]=nextLong()+os;
			return ar;
		}
		public double nextDouble() {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do
				ret = ret * 10 + c - '0';
			while ((c = read()) >= '0' && c <= '9');
			if (c == '.')
				while ((c = read()) >= '0' && c <= '9')
					ret += (c - '0') / (div *= 10);
			if (neg)
				return -ret;
			return ret;
		}
		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}
		private byte read() {
			try{
				if (bufferPointer == bytesRead)
					fillBuffer();
				return buffer[bufferPointer++];
			} catch(IOException e) {
				throw new RuntimeException();
			}
		}
		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}
}