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

public class Main{

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	}
static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
}

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

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	}
static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
} Main private static final int mod =(int)1e9+7; mod (int)1e9+7 (int)1e9 7 public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	} main {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	} Scanner  sc=new Scanner(System.in); sc new Scanner(System.in) PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc int count=0; count 0 int max=0; max 0 for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     } int i=0; int i=0; i 0 i<n i n i++ i++ i {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     } {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     } int x=sc.nextInt(); x sc.nextInt() sc.nextInt sc int y=sc.nextInt(); y sc.nextInt() sc.nextInt sc if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       } x==y x y {
	         count++;
	       } count++ count {
	         max=Math.max(count,max);
	         count=0;
	       } max=Math.max(count,max) max Math.max(count,max) Math.max Math count max count=0 count 0 max=Math.max(count,max) max Math.max(count,max) Math.max Math count max System.out.println(max>=3?"Yes":"No") System.out.println System.out System System.out max>=3?"Yes":"No" max>=3 max 3 "Yes" "No" String[] args args static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} nCr { 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} if (r == 0) 
return 1; r == 0 r 0 return 1; 1 int[] fac = new int[n + 1]; fac new int[n + 1] n + 1 n 1 fac[0] = 1 fac[0] fac 0 1 for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; int i = 1; int i = 1; i 1 i <= n i n i++ i++ i fac[i] = fac[i - 1] * i % p; fac[i] = fac[i - 1] * i % p fac[i] fac i fac[i - 1] * i % p fac[i - 1] * i fac[i - 1] fac i - 1 i 1 i p return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) fac[n] * modInverse(fac[r], p) 
% p fac[n] * modInverse(fac[r], p) fac[n] fac n modInverse(fac[r], p) modInverse fac[r] fac r p p modInverse(fac[n - r], p) modInverse fac[n - r] fac n - r n r p p p int n n int r r int p p static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} modInverse { 
    return pow(n, p - 2)%mod; 
} return pow(n, p - 2)%mod; pow(n, p - 2)%mod pow(n, p - 2) pow n p - 2 p 2 mod int n n int p p static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} pow {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} long res=1l; res 1l while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  } y!=0 y 0 {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  } if(y%2==1) {
      res=x*res%mod;
    } y%2==1 y%2 y 2 1 {
      res=x*res%mod;
    } res=x*res%mod res x*res%mod x*res x res mod y/=2 y 2 x=x*x%mod x x*x%mod x*x x x mod return res; res long x x long y y public class Main{

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	}
static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
} public class Main{

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	}
static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
} Main

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

public class Main{

	private static final int mod =(int)1e9+7;
	public static void main(String[] args) throws Exception  {
	      Scanner  sc=new Scanner(System.in);
	      PrintWriter out=new PrintWriter(System.out);
	     int n=sc.nextInt();
	     int count=0;
	     int max=0;
	     for(int i=0;i<n;i++) {
	       int x=sc.nextInt();
	       int y=sc.nextInt();
	       if(x==y) {
	         count++;
	       }else {
	         max=Math.max(count,max);
	         count=0;
	       }
	     }
	     max=Math.max(count,max);
	     System.out.println(max>=3?"Yes":"No");

	}
static long nCr(int n, int r, 
    int p) 
{ 


if (r == 0) 
return 1; 


int[] fac = new int[n + 1]; 
fac[0] = 1; 

for (int i = 1; i <= n; i++) 
fac[i] = fac[i - 1] * i % p; 

return (fac[n] * modInverse(fac[r], p) 
% p * modInverse(fac[n - r], p) 
% p) 
% p; 
} 
static long modInverse(int n, int p) 
{ 
    return pow(n, p - 2)%mod; 
} 
static long pow(long x,long y) {
  long res=1l;
  while(y!=0) {
    if(y%2==1) {
      res=x*res%mod;
    }
    y/=2;
    x=x*x%mod;
  }
  return res;
} 
}


