//package hiougyf;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
public class Main{	
		public static void main(String[] args){  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   }
		static double distance(long a,long b,long a1,long b1) {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		}
	
	  public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } 
		static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		}
	 
	  
	  public static int gcd(int a, int b) 
	    { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } 
	   public static int lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  }  
	   public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
       public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
	      
	
} import java.io.*; io.* java import java.util.*; util.* java import java.util.Map.Entry; Entry java.util.Map public class Main{	
		public static void main(String[] args){  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   }
		static double distance(long a,long b,long a1,long b1) {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		}
	
	  public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } 
		static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		}
	 
	  
	  public static int gcd(int a, int b) 
	    { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } 
	   public static int lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  }  
	   public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
       public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
	      
	
} Main public static void main(String[] args){  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   } main {  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   } Scanner sc =new Scanner(System.in); sc new Scanner(System.in) int hh=1000000007 hh 1000000007 t=sc.nextInt(); t sc.nextInt() sc.nextInt sc int ans=0 ans 0 k=0; k 0 while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	} t-->0 t-- t 0 {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	} int a=sc.nextInt(); a sc.nextInt() sc.nextInt sc int b=sc.nextInt(); b sc.nextInt() sc.nextInt sc if(a==b) ans++;
		else if(a!=b) ans=0; a==b a b ans++ ans if(a!=b) ans=0; a!=b a b ans=0 ans 0 if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		} ans>=3 ans 3 {
			System.out.println("Yes");
			k=9;
			break;
		} System.out.println("Yes") System.out.println System.out System System.out "Yes" k=9 k 9 break; if(k!=9) System.out.println("No"); k!=9 k 9 System.out.println("No") System.out.println System.out System System.out "No" String[] args args static double distance(long a,long b,long a1,long b1) {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		} distance {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		} double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1))); d1 Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1))) Math.sqrt Math ((a-a1)*(a-a1))+((b-b1)*(b-b1)) ((a-a1)*(a-a1)) (a-a1) a a1 (a-a1) a a1 ((b-b1)*(b-b1)) (b-b1) b b1 (b-b1) b b1 return d1; d1 long a a long b b long a1 a1 long b1 b1 public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } floorSqrt { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } if (x == 0 || x == 1) 
	            return x; x == 0 || x == 1 x == 0 x 0 x == 1 x 1 return x; x int start = 1 start 1 end = x end x ans=0; ans 0 while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } start <= end start end { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } int mid = (start + end) / 2; mid (start + end) / 2 (start + end) start end 2 if (mid*mid == x) 
	                return mid; mid*mid == x mid*mid mid mid x return mid; mid if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; mid*mid < x mid*mid mid mid x { 
	                start = mid + 1; 
	                ans = mid; 
	            } start = mid + 1 start mid + 1 mid 1 ans = mid ans mid end = mid-1 end mid-1 mid 1 return ans; ans int x x static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		} div {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		} int g=-1; g -1 1 for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			} int i=2; int i=2; i 2 i<=Math.sqrt(n) i Math.sqrt(n) Math.sqrt Math n i++ i++ i {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			} {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			} if(n%i==0&&i!=b) {
					g=i;
					break;
				} n%i==0&&i!=b n%i==0 n%i n i 0 i!=b i b {
					g=i;
					break;
				} g=i g i break; return g; g int n n int b b public static int gcd(int a, int b) 
	    { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } gcd { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } if (a == 0) 
	            return b; a == 0 a 0 return b; b return gcd(b%a, a); gcd(b%a, a) gcd b%a b a a int a a int b b public static int lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  } lcm {  
	     return (a*b)/gcd(a, b);  
	  } return (a*b)/gcd(a, b); (a*b)/gcd(a, b) (a*b) a b gcd(a, b) gcd a b int a a int b b public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       } isPrime1 {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       } if (n <= 1) {
               return false;
           } n <= 1 n 1 {
               return false;
           } return false; false if (n == 2) {
               return true;
           } n == 2 n 2 {
               return true;
           } return true; true for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           } int i = 2; int i = 2; i 2 i <= Math.sqrt(n) + 1 i Math.sqrt(n) + 1 Math.sqrt(n) Math.sqrt Math n 1 i++ i++ i {
               if (n % i == 0) {
                   return false;
               }
           } {
               if (n % i == 0) {
                   return false;
               }
           } if (n % i == 0) {
                   return false;
               } n % i == 0 n % i n i 0 {
                   return false;
               } return false; false return true; true int n n public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       } isPrime {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       } if (n <= 1) {
               return false;
           } n <= 1 n 1 {
               return false;
           } return false; false if (n == 2) {
               return true;
           } n == 2 n 2 {
               return true;
           } return true; true if (n % 2 == 0) {
               return false;
           } n % 2 == 0 n % 2 n 2 0 {
               return false;
           } return false; false for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           } int i = 3; int i = 3; i 3 i <= Math.sqrt(n) + 1 i Math.sqrt(n) + 1 Math.sqrt(n) Math.sqrt Math n 1 i = i + 2 i = i + 2 i i + 2 i 2 {
               if (n % i == 0) {
                   return false;
               }
           } {
               if (n % i == 0) {
                   return false;
               }
           } if (n % i == 0) {
                   return false;
               } n % i == 0 n % i n i 0 {
                   return false;
               } return false; false return true; true int n n public class Main{	
		public static void main(String[] args){  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   }
		static double distance(long a,long b,long a1,long b1) {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		}
	
	  public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } 
		static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		}
	 
	  
	  public static int gcd(int a, int b) 
	    { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } 
	   public static int lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  }  
	   public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
       public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
	      
	
} public class Main{	
		public static void main(String[] args){  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   }
		static double distance(long a,long b,long a1,long b1) {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		}
	
	  public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } 
		static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		}
	 
	  
	  public static int gcd(int a, int b) 
	    { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } 
	   public static int lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  }  
	   public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
       public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
	      
	
} Main
//package hiougyf;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
public class Main{	
		public static void main(String[] args){  
		Scanner sc =new Scanner(System.in);
		int hh=1000000007,t=sc.nextInt();
		int ans=0,k=0;
		while(t-->0) {
		int a=sc.nextInt();
		int b=sc.nextInt();
		if(a==b) ans++;
		else if(a!=b) ans=0;
		if(ans>=3) {
			System.out.println("Yes");
			k=9;
			break;
		}
		
	}
		if(k!=9) System.out.println("No");
		
   }
		static double distance(long a,long b,long a1,long b1) {
			//System.out.println(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			double d1=Math.sqrt(((a-a1)*(a-a1))+((b-b1)*(b-b1)));
			return d1;
		}
	
	  public static int floorSqrt(int x) 
	    { 
	        // Base Cases 
	        if (x == 0 || x == 1) 
	            return x; 
	  
	        // Do Binary Search for floor(sqrt(x)) 
	        int start = 1, end = x, ans=0; 
	        while (start <= end) 
	        { 
	            int mid = (start + end) / 2; 
	  
	            // If x is a perfect square 
	            if (mid*mid == x) 
	                return mid; 
	  
	            // Since we need floor, we update answer when mid*mid is 
	            // smaller than x, and move closer to sqrt(x) 
	            if (mid*mid < x) 
	            { 
	                start = mid + 1; 
	                ans = mid; 
	            } 
	            else   // If mid*mid is greater than x 
	                end = mid-1; 
	        } 
	        return ans; 
	    } 
		static int div(int n,int b) {
			int g=-1;
			for(int i=2;i<=Math.sqrt(n);i++) {
				if(n%i==0&&i!=b) {
					g=i;
					break;
				}
			}
			return g;
		}
	 
	  
	  public static int gcd(int a, int b) 
	    { 
	        if (a == 0) 
	            return b; 
	          
	        return gcd(b%a, a); 
	    } 
	   public static int lcm(int a, int b)  
	  {  
	     return (a*b)/gcd(a, b);  
	  }  
	   public static boolean isPrime1(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           for (int i = 2; i <= Math.sqrt(n) + 1; i++) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
       public static boolean isPrime(int n) {
           if (n <= 1) {
               return false;
           }
           if (n == 2) {
               return true;
           }
           if (n % 2 == 0) {
               return false;
           }
           for (int i = 3; i <= Math.sqrt(n) + 1; i = i + 2) {
               if (n % i == 0) {
                   return false;
               }
           }
           return true;
       }
	      
	
}