import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.text.*;
public class Main {
    static int mod = 1000_000_007;
    static long lim = (long)1e9 + 6;
    static long mod1 = 998244353;
    static boolean fileIO = false;
    static FastScanner f;
    static int inf = 2000_000_000;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static long iinf = (long)(1e18);
    static double eps = (double)1e-4;
    public static void solve()throws IOException {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    }  
    public static void main(String[] args)throws IOException {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{f=new FastScanner(System.in);}
    public static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;
 
        public FastScanner(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void pn(Object o){pw.println(o);}
    public static void pi(Object o){pw.print(o);pw.flush();}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b, long m){long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}
} import java.util.*; util.* java import java.io.*; io.* java import java.math.BigInteger; BigInteger java.math import java.text.*; text.* java public class Main {
    static int mod = 1000_000_007;
    static long lim = (long)1e9 + 6;
    static long mod1 = 998244353;
    static boolean fileIO = false;
    static FastScanner f;
    static int inf = 2000_000_000;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static long iinf = (long)(1e18);
    static double eps = (double)1e-4;
    public static void solve()throws IOException {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    }  
    public static void main(String[] args)throws IOException {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{f=new FastScanner(System.in);}
    public static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;
 
        public FastScanner(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void pn(Object o){pw.println(o);}
    public static void pi(Object o){pw.print(o);pw.flush();}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b, long m){long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}
} Main static int mod = 1000_000_007; mod 1000_000_007 static long lim = (long)1e9 + 6; lim (long)1e9 + 6 (long)1e9 6 static long mod1 = 998244353; mod1 998244353 static boolean fileIO = false; fileIO false static FastScanner f; f static int inf = 2000_000_000; inf 2000_000_000 static PrintWriter pw = new PrintWriter(System.out); pw new PrintWriter(System.out) static Scanner S = new Scanner(System.in); S new Scanner(System.in) static long x0; x0 static long y0; y0 static long iinf = (long)(1e18); iinf (long)(1e18) static double eps = (double)1e-4; eps (double)1e-4 public static void solve()throws IOException {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    } solve {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    } int n = f.ni(); n f.ni() f.ni f boolean ok = false; ok false int arr[][] = new int[n][2]; arr new int[n][2] n 2 for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        } int i = 0; int i = 0; i 0 i < n i n ++i ++i i {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        } {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        } arr[i][0] = f.ni() arr[i][0] arr[i] arr i 0 f.ni() f.ni f arr[i][1] = f.ni() arr[i][1] arr[i] arr i 1 f.ni() f.ni f for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        } int i = 0; int i = 0; i 0 i + 2 < n i + 2 i 2 n ++i ++i i {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        } {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        } if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1] arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1] arr[i][0] == arr[i][1] arr[i][0] arr[i] arr i 0 arr[i][1] arr[i] arr i 1 arr[i + 1][0] == arr[i + 1][1] arr[i + 1][0] arr[i + 1] arr i + 1 i 1 0 arr[i + 1][1] arr[i + 1] arr i + 1 i 1 1 arr[i + 2][0] == arr[i + 2][1] arr[i + 2][0] arr[i + 2] arr i + 2 i 2 0 arr[i + 2][1] arr[i + 2] arr i + 2 i 2 1 ok = true ok true pn(ok ? "Yes" : "No") pn ok ? "Yes" : "No" ok "Yes" "No" public static void main(String[] args)throws IOException {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    } main {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    } init() init int t = 1; t 1 int tt = 1; tt 1 while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        } t --> 0 t -- t 0 {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        } solve() solve pw.flush() pw.flush pw pw.close() pw.close pw String[] args args /******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{f=new FastScanner(System.in);} init {f=new FastScanner(System.in);} f=new FastScanner(System.in) f new FastScanner(System.in) public static void pn(Object o){pw.println(o);} pn {pw.println(o);} pw.println(o) pw.println pw o Object o o public static void pi(Object o){pw.print(o);pw.flush();} pi {pw.print(o);pw.flush();} pw.print(o) pw.print pw o pw.flush() pw.flush pw Object o o public static void p(Object o){pw.print(o);} p {pw.print(o);} pw.print(o) pw.print pw o Object o o public static void pni(Object o){pw.println(o);pw.flush();} pni {pw.println(o);pw.flush();} pw.println(o) pw.println pw o pw.flush() pw.flush pw Object o o static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}} gcd {if(b==0)return a;else{return gcd(b,a%b);}} if(b==0)return a;else{return gcd(b,a%b);} b==0 b 0 return a; a {return gcd(b,a%b);} return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b int a a int b b static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}} gcd {if(b==0l)return a;else{return gcd(b,a%b);}} if(b==0l)return a;else{return gcd(b,a%b);} b==0l b 0l return a; a {return gcd(b,a%b);} return gcd(b,a%b); gcd(b,a%b) gcd b a%b a b long a a long b b static long lcm(long a,long 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 long a a long b b static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;} exgcd {if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;} if(b==0){x0=1;y0=0;return a;} b==0 b 0 {x0=1;y0=0;return a;} x0=1 x0 1 y0=0 y0 0 return a; a long temp=exgcd(b,a%b); temp exgcd(b,a%b) exgcd b a%b a b long t=x0; t x0 x0=y0 x0 y0 y0=t-a/b*y0 y0 t-a/b*y0 t a/b*y0 a/b a b y0 return temp; temp long a a long b b static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;} pow {long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;} long res=1; res 1 while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;} b>0 b 0 {if((b&1)==1)res=res*a;b>>=1;a=a*a;} if((b&1)==1)res=res*a; (b&1)==1 (b&1) b 1 1 res=res*a res res*a res a b>>=1 b 1 a=a*a a a*a a a return res; res long a a long b b static long mpow(long a,long b, long m){long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;} mpow {long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;} long res=1; res 1 while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;} b>0 b 0 {if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;} if((b&1)==1)res=((res%m)*(a%m))%m; (b&1)==1 (b&1) b 1 1 res=((res%m)*(a%m))%m res ((res%m)*(a%m))%m ((res%m)*(a%m)) (res%m) res m (a%m) a m m b>>=1 b 1 a=((a%m)*(a%m))%m a ((a%m)*(a%m))%m ((a%m)*(a%m)) (a%m) a m (a%m) a m m return res; res long a a long b b long m m static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);} mul {return ((a%mod)*(b%mod)%mod);} return ((a%mod)*(b%mod)%mod); ((a%mod)*(b%mod)%mod) (a%mod)*(b%mod) (a%mod) a mod (b%mod) b mod mod long a a long b b static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);} adp {return ((a%mod)+(b%mod)%mod);} return ((a%mod)+(b%mod)%mod); ((a%mod)+(b%mod)%mod) (a%mod) a mod (b%mod)%mod (b%mod) b mod mod long a a long b b static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;} isPrime {if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;} if(n<=1)return false; n<=1 n 1 return false; false if(n<=3)return true; n<=3 n 3 return true; true if(n%2==0||n%3==0)return false; n%2==0||n%3==0 n%2==0 n%2 n 2 0 n%3==0 n%3 n 3 0 return false; false for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false; long i=5; long i=5; i 5 i*i<=n i*i i i n i=i+6 i=i+6 i i+6 i 6 if(n%i==0||n%(i+2)==0)return false; if(n%i==0||n%(i+2)==0)return false; n%i==0||n%(i+2)==0 n%i==0 n%i n i 0 n%(i+2)==0 n%(i+2) n (i+2) i 2 0 return false; false return true; true long n n static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;} isPrime {if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;} if(n<=1)return false; n<=1 n 1 return false; false if(n<=3)return true; n<=3 n 3 return true; true if(n%2==0||n%3==0)return false; n%2==0||n%3==0 n%2==0 n%2 n 2 0 n%3==0 n%3 n 3 0 return false; false for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false; int i=5; int i=5; i 5 i*i<=n i*i i i n i=i+6 i=i+6 i i+6 i 6 if(n%i==0||n%(i+2)==0)return false; if(n%i==0||n%(i+2)==0)return false; n%i==0||n%(i+2)==0 n%i==0 n%i n i 0 n%(i+2)==0 n%(i+2) n (i+2) i 2 0 return false; false return true; true int n n static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;} factors {HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;} HashSet<Long> hs=new HashSet<Long>(); hs new HashSet<Long>() for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}} long i=1; long i=1; i 1 i<=(long)Math.sqrt(n) i (long)Math.sqrt(n) Math.sqrt Math n i++ i++ i {if(n%i==0){hs.add(i);hs.add(n/i);}} {if(n%i==0){hs.add(i);hs.add(n/i);}} if(n%i==0){hs.add(i);hs.add(n/i);} n%i==0 n%i n i 0 {hs.add(i);hs.add(n/i);} hs.add(i) hs.add hs i hs.add(n/i) hs.add hs n/i n i return hs; hs long n n static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;} factors {HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;} HashSet<Integer> hs=new HashSet<Integer>(); hs new HashSet<Integer>() for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}} int i=1; int i=1; i 1 i<=(int)Math.sqrt(n) i (int)Math.sqrt(n) Math.sqrt Math n i++ i++ i {if(n%i==0){hs.add(i);hs.add(n/i);}} {if(n%i==0){hs.add(i);hs.add(n/i);}} if(n%i==0){hs.add(i);hs.add(n/i);} n%i==0 n%i n i 0 {hs.add(i);hs.add(n/i);} hs.add(i) hs.add hs i hs.add(n/i) hs.add hs n/i n i return hs; hs int n n static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;} pf {HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;} HashSet<Long> ff=factors(n); ff factors(n) factors n HashSet<Long> ans=new HashSet<Long>(); ans new HashSet<Long>() for(Long i:ff)if(isPrime(i))ans.add(i); Long i ff if(isPrime(i))ans.add(i); if(isPrime(i))ans.add(i); isPrime(i) isPrime i ans.add(i) ans.add ans i return ans; ans long n n static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;} pf {HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;} HashSet<Integer> ff=factors(n); ff factors(n) factors n HashSet<Integer> ans=new HashSet<Integer>(); ans new HashSet<Integer>() for(Integer i:ff)if(isPrime(i))ans.add(i); Integer i ff if(isPrime(i))ans.add(i); if(isPrime(i))ans.add(i); isPrime(i) isPrime i ans.add(i) ans.add ans i return ans; ans int n n static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;} inpint {int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;} int arr[]=new int[n+1]; arr new int[n+1] n+1 n 1 for(int i=1;i<=n;++i){arr[i]=f.ni();} int i=1; int i=1; i 1 i<=n i n ++i ++i i {arr[i]=f.ni();} {arr[i]=f.ni();} arr[i]=f.ni() arr[i] arr i f.ni() f.ni f return arr; arr int n n static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;} inplong {long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;} long arr[] = new long[n+1]; arr new long[n+1] n+1 n 1 for(int i=1;i<=n;++i){arr[i]=f.nl();} int i=1; int i=1; i 1 i<=n i n ++i ++i i {arr[i]=f.nl();} {arr[i]=f.nl();} arr[i]=f.nl() arr[i] arr i f.nl() f.nl f return arr; arr int n n static boolean ise(int x){return ((x&1)==0);} ise {return ((x&1)==0);} return ((x&1)==0); ((x&1)==0) (x&1) x 1 0 int x x static boolean ise(long x){return ((x&1)==0);} ise {return ((x&1)==0);} return ((x&1)==0); ((x&1)==0) (x&1) x 1 0 long x x static int gnv(char c){return Character.getNumericValue(c);} gnv {return Character.getNumericValue(c);} return Character.getNumericValue(c); Character.getNumericValue(c) Character.getNumericValue Character c char c c static int log(long x){return x==1?0:(1+log(x/2));} log {return x==1?0:(1+log(x/2));} return x==1?0:(1+log(x/2)); x==1?0:(1+log(x/2)) x==1 x 1 0 (1+log(x/2)) 1 log(x/2) log x/2 x 2 long x x static int log(int x){return x==1?0:(1+log(x/2));} log {return x==1?0:(1+log(x/2));} return x==1?0:(1+log(x/2)); x==1?0:(1+log(x/2)) x==1 x 1 0 (1+log(x/2)) 1 log(x/2) log x/2 x 2 int x x static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);} sort {ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);} ArrayList<Integer> l=new ArrayList<>(); l new ArrayList<>() for(int i:a)l.add(i); int i a l.add(i); l.add(i) l.add l i Collections.sort(l) Collections.sort Collections l for(int i=0;i<a.length;++i)a[i]=l.get(i); int i=0; int i=0; i 0 i<a.length i a.length a a.length ++i ++i i a[i]=l.get(i); a[i]=l.get(i) a[i] a i l.get(i) l.get l i int[] a a static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);} sort {ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);} ArrayList<Long> l=new ArrayList<>(); l new ArrayList<>() for(long i:a)l.add(i); long i a l.add(i); l.add(i) l.add l i Collections.sort(l) Collections.sort Collections l for(int i=0;i<a.length;++i)a[i]=l.get(i); int i=0; int i=0; i 0 i<a.length i a.length a a.length ++i ++i i a[i]=l.get(i); a[i]=l.get(i) a[i] a i l.get(i) l.get l i long[] a a static void sort(ArrayList<Integer> a){Collections.sort(a);} sort {Collections.sort(a);} Collections.sort(a) Collections.sort Collections a ArrayList<Integer> a a public static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;
 
        public FastScanner(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    } FastScanner private InputStream stream; stream private byte[] buf = new byte[1024]; buf new byte[1024] 1024 private int curChar; curChar private int numChars; numChars private FastScanner.SpaceCharFilter filter; filter public FastScanner(InputStream stream) {
            this.stream = stream;
        } FastScanner {
            this.stream = stream;
        } this.stream = stream this.stream this this.stream stream InputStream stream stream public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        } read {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        } if (numChars == -1)
                throw new InputMismatchException(); numChars == -1 numChars -1 1 throw new InputMismatchException(); new InputMismatchException() if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            } curChar >= numChars curChar numChars {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            } curChar = 0 curChar 0 try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                } catch (IOException e) {
                    throw new InputMismatchException();
                } IOException e {
                    throw new InputMismatchException();
                } throw new InputMismatchException(); new InputMismatchException() {
                    numChars = stream.read(buf);
                } numChars = stream.read(buf) numChars stream.read(buf) stream.read stream buf if (numChars <= 0)
                    return -1; numChars <= 0 numChars 0 return -1; -1 1 return buf[curChar++]; buf[curChar++] buf curChar++ curChar public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        } ni {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        } int c = read(); c read() read while (isSpaceChar(c))
                c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
                sgn = -1;
                c = read();
            } c == '-' c '-' {
                sgn = -1;
                c = read();
            } sgn = -1 sgn -1 1 c = read() c read() read int res = 0; res 0 do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } if (c < '0' || c > '9') throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        } nl {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        } int c = read(); c read() read while (isSpaceChar(c))
                c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read int sgn = 1; sgn 1 if (c == '-') {
                sgn = -1;
                c = read();
            } c == '-' c '-' {
                sgn = -1;
                c = read();
            } sgn = -1 sgn -1 1 c = read() c read() read long res = 0; res 0 do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } if (c < '0' || c > '9') throw new InputMismatchException(); c < '0' || c > '9' c < '0' c '0' c > '9' c '9' throw new InputMismatchException(); new InputMismatchException() res *= 10 res 10 res += c - '0' res c - '0' c '0' c = read() c read() read return res * sgn; res * sgn res sgn public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        } next {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        } int c = read(); c read() read while (isSpaceChar(c))
                c = read(); isSpaceChar(c) isSpaceChar c c = read() c read() read StringBuilder res = new StringBuilder(); res new StringBuilder() do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c)); !isSpaceChar(c) isSpaceChar(c) isSpaceChar c {
                res.appendCodePoint(c);
                c = read();
            } res.appendCodePoint(c) res.appendCodePoint res c c = read() c read() read return res.toString(); res.toString() res.toString res public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        } isSpaceChar {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        } if (filter != null)
                return filter.isSpaceChar(c); filter != null filter null return filter.isSpaceChar(c); filter.isSpaceChar(c) filter.isSpaceChar filter c return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == '\t' c == '\r' c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1 c == ' ' c ' ' c == '\n' c '\n' c == '\r' c '\r' c == '\t' c '\t' c == -1 c -1 1 int c c public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        } SpaceCharFilter public boolean isSpaceChar(int ch); isSpaceChar int ch ch public class Main {
    static int mod = 1000_000_007;
    static long lim = (long)1e9 + 6;
    static long mod1 = 998244353;
    static boolean fileIO = false;
    static FastScanner f;
    static int inf = 2000_000_000;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static long iinf = (long)(1e18);
    static double eps = (double)1e-4;
    public static void solve()throws IOException {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    }  
    public static void main(String[] args)throws IOException {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{f=new FastScanner(System.in);}
    public static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;
 
        public FastScanner(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void pn(Object o){pw.println(o);}
    public static void pi(Object o){pw.print(o);pw.flush();}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b, long m){long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}
} public class Main {
    static int mod = 1000_000_007;
    static long lim = (long)1e9 + 6;
    static long mod1 = 998244353;
    static boolean fileIO = false;
    static FastScanner f;
    static int inf = 2000_000_000;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static long iinf = (long)(1e18);
    static double eps = (double)1e-4;
    public static void solve()throws IOException {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    }  
    public static void main(String[] args)throws IOException {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{f=new FastScanner(System.in);}
    public static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;
 
        public FastScanner(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void pn(Object o){pw.println(o);}
    public static void pi(Object o){pw.print(o);pw.flush();}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b, long m){long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}
} Main
import java.util.*;
import java.io.*;
import java.math.BigInteger;
import java.text.*;
public class Main {
    static int mod = 1000_000_007;
    static long lim = (long)1e9 + 6;
    static long mod1 = 998244353;
    static boolean fileIO = false;
    static FastScanner f;
    static int inf = 2000_000_000;
    static PrintWriter pw = new PrintWriter(System.out);
    static Scanner S = new Scanner(System.in);
    static long x0; static long y0;
    static long iinf = (long)(1e18);
    static double eps = (double)1e-4;
    public static void solve()throws IOException {
        int n = f.ni();
        boolean ok = false;
        int arr[][] = new int[n][2];
        for (int i = 0; i < n; ++i) {
            arr[i][0] = f.ni();
            arr[i][1] = f.ni();
        }

        for (int i = 0; i + 2 < n; ++i) {
            if (arr[i][0] == arr[i][1] && arr[i + 1][0] == arr[i + 1][1] && arr[i + 2][0] == arr[i + 2][1]) ok = true; 
        }

        pn(ok ? "Yes" : "No");
    }  
    public static void main(String[] args)throws IOException {
        init();
        //pre();
        int t = 1;
        int tt = 1;
        //fw = new FileWriter("!out.txt");
        while(t --> 0) {
            //fw.write("Case #" + (tt++) + ": ");
            //fw.write("\n");
            solve();
        }
        pw.flush(); 
        pw.close();
        //fw.close();  
    }
        
/******************************END OF MAIN PROGRAM*******************************************/
    public static void init()throws IOException{f=new FastScanner(System.in);}
    public static class FastScanner {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastScanner.SpaceCharFilter filter;
 
        public FastScanner(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
 
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
 
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        public int ni() {
            int c = read();
 
            while (isSpaceChar(c))
                c = read();
 
            int sgn = 1;
 
            if (c == '-') {
                sgn = -1;
                c = read();
            }
 
            int res = 0;
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
 
            return res * sgn;
        }
 
        public long nl() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
 
            do {
                if (c < '0' || c > '9') throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));
            return res.toString();
        }
 
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void pn(Object o){pw.println(o);}
    public static void pi(Object o){pw.print(o);pw.flush();}
    public static void p(Object o){pw.print(o);}
    public static void pni(Object o){pw.println(o);pw.flush();}
    static int gcd(int a,int b){if(b==0)return a;else{return gcd(b,a%b);}}
    static long gcd(long a,long b){if(b==0l)return a;else{return gcd(b,a%b);}}
    static long lcm(long a,long b){return (a*b/gcd(a,b));}
    static long exgcd(long a,long b){if(b==0){x0=1;y0=0;return a;}long temp=exgcd(b,a%b);long t=x0;x0=y0;y0=t-a/b*y0;return temp;}
    static long pow(long a,long b){long res=1;while(b>0){if((b&1)==1)res=res*a;b>>=1;a=a*a;}return res;}
    static long mpow(long a,long b, long m){long res=1;while(b>0){if((b&1)==1)res=((res%m)*(a%m))%m;b>>=1;a=((a%m)*(a%m))%m;}return res;}
    static long mul(long a , long b){return ((a%mod)*(b%mod)%mod);}
    static long adp(long a , long b){return ((a%mod)+(b%mod)%mod);}
    static boolean isPrime(long n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(long i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static boolean isPrime(int n){if(n<=1)return false;if(n<=3)return true;if(n%2==0||n%3==0)return false;for(int i=5;i*i<=n;i=i+6)if(n%i==0||n%(i+2)==0)return false;return true;}
    static HashSet<Long> factors(long n){HashSet<Long> hs=new HashSet<Long>();for(long i=1;i<=(long)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Integer> factors(int n){HashSet<Integer> hs=new HashSet<Integer>();for(int i=1;i<=(int)Math.sqrt(n);i++){if(n%i==0){hs.add(i);hs.add(n/i);}}return hs;}
    static HashSet<Long> pf(long n){HashSet<Long> ff=factors(n);HashSet<Long> ans=new HashSet<Long>();for(Long i:ff)if(isPrime(i))ans.add(i);return ans;}
    static HashSet<Integer> pf(int n){HashSet<Integer> ff=factors(n);HashSet<Integer> ans=new HashSet<Integer>();for(Integer i:ff)if(isPrime(i))ans.add(i);return ans;}
    static int[] inpint(int n){int arr[]=new int[n+1];for(int i=1;i<=n;++i){arr[i]=f.ni();}return arr;}
    static long[] inplong(int n){long arr[] = new long[n+1];for(int i=1;i<=n;++i){arr[i]=f.nl();}return arr;}
    static boolean ise(int x){return ((x&1)==0);}static boolean ise(long x){return ((x&1)==0);}
    static int gnv(char c){return Character.getNumericValue(c);}
    static int log(long x){return x==1?0:(1+log(x/2));} static int log(int x){return x==1?0:(1+log(x/2));}
    static void sort(int[] a){ArrayList<Integer> l=new ArrayList<>();for(int i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(long[] a){ArrayList<Long> l=new ArrayList<>();for(long i:a)l.add(i);Collections.sort(l);for(int i=0;i<a.length;++i)a[i]=l.get(i);}
    static void sort(ArrayList<Integer> a){Collections.sort(a);}
}