/******************Author: Satyajeet Singh************************************/
    import java.io.*;
    import java.util.*;
    import java.text.*; 
    import java.lang.*;
    import java.math.*;
public class Main{
/*********************************************Constants***********************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));        
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins*********************************/
    
    public static void main(String args[]) throws Exception{
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    }
    static void clr(){
        out.flush();
        out.close();
    }
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing*********************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph******************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }    
/*********************************************PAIR*****************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair***************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG********************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION********************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD*******************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
} import java.io.*; io.* java import java.util.*; util.* java import java.text.*; text.* java import java.lang.*; lang.* java import java.math.*; math.* java public class Main{
/*********************************************Constants***********************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));        
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins*********************************/
    
    public static void main(String args[]) throws Exception{
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    }
    static void clr(){
        out.flush();
        out.close();
    }
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing*********************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph******************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }    
/*********************************************PAIR*****************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair***************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG********************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION********************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD*******************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
} Main /*********************************************Constants***********************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out)); out new PrintWriter(new OutputStreamWriter(System.out)) static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) static long mod=(long)1e9+7; mod (long)1e9+7 (long)1e9 7 static long mod1=998244353; mod1 998244353 static ArrayList<Integer> graph[]; graph static int pptr=0 pptr 0 pptrmax=0; pptrmax 0 static String st[]; st /*****************************************Solution Begins*********************************/
    
    public static void main(String args[]) throws Exception{
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    } main {
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    } int n=pi(); n pi() pi int input[][]=new int[n][2]; input new int[n][2] n 2 for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        } {
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        } for(int j=0;j<2;j++){
                input[i][j]=pi();
            } int j=0; int j=0; j 0 j<2 j 2 j++ j++ j {
                input[i][j]=pi();
            } {
                input[i][j]=pi();
            } input[i][j]=pi() input[i][j] input[i] input i j pi() pi boolean flag=false; flag false for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        } {
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        } int cnt=0; cnt 0 for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            } int j=i; int j=i; j i j<n j n j++ j++ j {
                if(input[j][0]!=input[j][1])break;
                cnt++;
            } {
                if(input[j][0]!=input[j][1])break;
                cnt++;
            } if(input[j][0]!=input[j][1])break; input[j][0]!=input[j][1] input[j][0] input[j] input j 0 input[j][1] input[j] input j 1 break; cnt++ cnt if(cnt>=3){
                flag=true;
                break;
            } cnt>=3 cnt 3 {
                flag=true;
                break;
            } flag=true flag true break; if(flag)out.println("Yes");
        else out.println("No"); flag out.println("Yes") out.println out "Yes" out.println("No") out.println out "No" clr() clr String args[] args static void clr(){
        out.flush();
        out.close();
    } clr {
        out.flush();
        out.close();
    } out.flush() out.flush out out.close() out.close out static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    } nl {
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    } pptr=0 pptr 0 st=br.readLine().split(" ") st br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " pptrmax=st.length pptrmax st.length st st.length static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    } nls {
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    } pptr=0 pptr 0 st=br.readLine().split("") st br.readLine().split("") br.readLine().split br.readLine() br.readLine br "" pptrmax=st.length pptrmax st.length st st.length static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    } pi {
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    } if(pptr==pptrmax)
            nl(); pptr==pptrmax pptr pptrmax nl() nl return Integer.parseInt(st[pptr++]); Integer.parseInt(st[pptr++]) Integer.parseInt Integer st[pptr++] st pptr++ pptr static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    } pl {
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    } if(pptr==pptrmax)
            nl(); pptr==pptrmax pptr pptrmax nl() nl return Long.parseLong(st[pptr++]); Long.parseLong(st[pptr++]) Long.parseLong Long st[pptr++] st pptr++ pptr static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    } pd {
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    } if(pptr==pptrmax)
            nl(); pptr==pptrmax pptr pptrmax nl() nl return Double.parseDouble(st[pptr++]); Double.parseDouble(st[pptr++]) Double.parseDouble Double st[pptr++] st pptr++ pptr static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    } ps {
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    } if(pptr==pptrmax)
            nl(); pptr==pptrmax pptr pptrmax nl() nl return st[pptr++]; st[pptr++] st pptr++ pptr /***************************************Precision Printing*********************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    } printPrecision {
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    } DecimalFormat ft = new DecimalFormat("0.00000000000"); ft new DecimalFormat("0.00000000000") out.println(ft.format(d)) out.println out ft.format(d) ft.format ft d double d d /**************************************Bit Manipulation************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    } countBit {
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    } int ans=0; ans 0 while(mask!=0){
            mask&=(mask-1);
            ans++;
        } mask!=0 mask 0 {
            mask&=(mask-1);
            ans++;
        } mask&=(mask-1) mask (mask-1) mask 1 ans++ ans return ans; ans long mask mask /******************************************Graph******************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    } Makegraph {
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    } graph=new ArrayList[n] graph new ArrayList[n] n for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>(); int i=0; int i=0; i 0 i<n i n i++ i++ i graph[i]=new ArrayList<>(); graph[i]=new ArrayList<>() graph[i] graph i new ArrayList<>() int n n static void addEdge(int a,int b){
        graph[a].add(b);
    } addEdge {
        graph[a].add(b);
    } graph[a].add(b) graph[a].add graph[a] graph a b int a a int b b /*****************************************DEBUG********************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    } debug {
        System.out.println(Arrays.deepToString(o));
    } System.out.println(Arrays.deepToString(o)) System.out.println System.out System System.out Arrays.deepToString(o) Arrays.deepToString Arrays o Object... o o /************************************MODULAR EXPONENTIATION********************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    } modulo {
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    } long x=1 x 1 y=a%c; y a%c a c while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        } b > 0 b 0 {
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        } if(b%2 == 1)
                x=(x*y)%c; b%2 == 1 b%2 b 2 1 x=(x*y)%c x (x*y)%c (x*y) x y c y = (y*y)%c y (y*y)%c (y*y) y y c b = b>>1 b b>>1 b 1 return  x%c; x%c x c long a a long b b long c c /********************************************GCD*******************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    } gcd {
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    } if(x==0)
            return y; x==0 x 0 return y; y if(y==0)
            return x; y==0 y 0 return x; x long r=0 r 0 a a b; b a = (x > y) ? x : y a (x > y) ? x : y (x > y) x y x y b = (x < y) ? x : y b (x < y) ? x : y (x < y) x y x y r = b r b while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        } a % b != 0 a % b a b 0 {
            r = a % b;
            a = b;
            b = r;
        } r = a % b r a % b a b a = b a b b = r b r return r; r long x x long y y     static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    } Pair int u; u int v; v public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        } Pair {
            this.u = u;
            this.v = v;
        } this.u = u this.u this this.u u this.v = v this.v this this.v v int u u int v v public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        } hashCode {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        } int hu = (int) (u ^ (u >>> 32)); hu (int) (u ^ (u >>> 32)) u (u >>> 32) u 32 int hv = (int) (v ^ (v >>> 32)); hv (int) (v ^ (v >>> 32)) v (v >>> 32) v 32 return 31 * hu + hv; 31 * hu + hv 31 * hu 31 hu hv public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        } equals {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        } Pair other = (Pair) o; other (Pair) o return u == other.u && v == other.v; u == other.u && v == other.v u == other.u u other.u other other.u v == other.v v other.v other other.v Object o o public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        } toString {
            return "[u=" + u + ", v=" + v + "]";
        } return "[u=" + u + ", v=" + v + "]"; "[u=" + u + ", v=" + v + "]" v ", v=" "[u=" + u + ", v=" + v + "]" "[u=" u ", v=" v "]"     static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    } Pairl long u; u long v; v public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        } Pairl {
            this.u = u;
            this.v = v;
        } this.u = u this.u this this.u u this.v = v this.v this this.v v long u u long v v public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        } hashCode {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        } int hu = (int) (u ^ (u >>> 32)); hu (int) (u ^ (u >>> 32)) u (u >>> 32) u 32 int hv = (int) (v ^ (v >>> 32)); hv (int) (v ^ (v >>> 32)) v (v >>> 32) v 32 return 31 * hu + hv; 31 * hu + hv 31 * hu 31 hu hv public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        } equals {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        } Pairl other = (Pairl) o; other (Pairl) o return u == other.u && v == other.v; u == other.u && v == other.v u == other.u u other.u other other.u v == other.v v other.v other other.v Object o o public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        } toString {
            return "[u=" + u + ", v=" + v + "]";
        } return "[u=" + u + ", v=" + v + "]"; "[u=" + u + ", v=" + v + "]" v ", v=" "[u=" + u + ", v=" + v + "]" "[u=" u ", v=" v "]" public class Main{
/*********************************************Constants***********************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));        
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins*********************************/
    
    public static void main(String args[]) throws Exception{
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    }
    static void clr(){
        out.flush();
        out.close();
    }
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing*********************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph******************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }    
/*********************************************PAIR*****************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair***************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG********************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION********************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD*******************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
} public class Main{
/*********************************************Constants***********************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));        
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins*********************************/
    
    public static void main(String args[]) throws Exception{
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    }
    static void clr(){
        out.flush();
        out.close();
    }
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing*********************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph******************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }    
/*********************************************PAIR*****************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair***************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG********************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION********************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD*******************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
} Main
/******************Author: Satyajeet Singh************************************/
    import java.io.*;
    import java.util.*;
    import java.text.*; 
    import java.lang.*;
    import java.math.*;
public class Main{
/*********************************************Constants***********************************/
    static PrintWriter out=new PrintWriter(new OutputStreamWriter(System.out));        
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static long mod=(long)1e9+7;
    static long mod1=998244353;
    static ArrayList<Integer> graph[];
    static int pptr=0,pptrmax=0;
    static String st[];
/*****************************************Solution Begins*********************************/
    
    public static void main(String args[]) throws Exception{
        int n=pi();
        int input[][]=new int[n][2];
        for(int i=0;i<n;i++){
            for(int j=0;j<2;j++){
                input[i][j]=pi();
            }
        }
        boolean flag=false;
        for(int i=0;i<n;i++){
            int cnt=0;
            for(int j=i;j<n;j++){
                if(input[j][0]!=input[j][1])break;
                cnt++;
            }
            if(cnt>=3){
                flag=true;
                break;
            }
        }
        if(flag)out.println("Yes");
        else out.println("No");
/****************************************Solution Ends*************************************/
        clr();
    }
    static void clr(){
        out.flush();
        out.close();
    }
    static void nl() throws Exception{
        pptr=0;
        st=br.readLine().split(" ");
        pptrmax=st.length;
    }
    static void nls() throws Exception{
        pptr=0;
        st=br.readLine().split("");
        pptrmax=st.length;
    }
    static int pi() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Integer.parseInt(st[pptr++]);
    }
    static long pl() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Long.parseLong(st[pptr++]);
    }
    static double pd() throws Exception{
        if(pptr==pptrmax)
            nl();
        return Double.parseDouble(st[pptr++]);
    }
    static String ps() throws Exception{
        if(pptr==pptrmax)
            nl();
        return st[pptr++];
    }
/***************************************Precision Printing*********************************/
    static void printPrecision(double d){
        DecimalFormat ft = new DecimalFormat("0.00000000000"); 
        out.println(ft.format(d));
    }
/**************************************Bit Manipulation************************************/
    static int countBit(long mask){
        int ans=0;
        while(mask!=0){
            mask&=(mask-1);
            ans++;
        }
        return ans;
    }
/******************************************Graph******************************************/
    static void Makegraph(int n){
        graph=new ArrayList[n];
        for(int i=0;i<n;i++)
            graph[i]=new ArrayList<>();
    }
    static void addEdge(int a,int b){
        graph[a].add(b);
    }
    // static void addEdge(int a,int b,int c){
    //     graph[a].add(new Pair(b,c));
    // }    
/*********************************************PAIR*****************************************/
    static class Pair{
        int u;
        int v;
        public Pair(int u, int v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pair other = (Pair) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/******************************************Long Pair***************************************/
    static class Pairl{
        long u;
        long v;
        public Pairl(long u, long v) {
            this.u = u;
            this.v = v;
        }
        public int hashCode() {
            int hu = (int) (u ^ (u >>> 32));
            int hv = (int) (v ^ (v >>> 32));
            return 31 * hu + hv;
        }
        public boolean equals(Object o) {
            Pairl other = (Pairl) o;
            return u == other.u && v == other.v;
        }
        public String toString() {
            return "[u=" + u + ", v=" + v + "]";
        }
    }
/*****************************************DEBUG********************************************/
    public static void debug(Object... o){
        System.out.println(Arrays.deepToString(o));
    }
/************************************MODULAR EXPONENTIATION********************************/
    static long modulo(long a,long b,long c){
        long x=1,y=a%c;
        while(b > 0){
            if(b%2 == 1)
                x=(x*y)%c;
            y = (y*y)%c;
            b = b>>1;
        }
        return  x%c;
    }
/********************************************GCD*******************************************/
    static long gcd(long x, long y){
        if(x==0)
            return y;
        if(y==0)
            return x;
        long r=0, a, b;
        a = (x > y) ? x : y; 
        b = (x < y) ? x : y;
        r = b;
        while(a % b != 0){
            r = a % b;
            a = b;
            b = r;
        }
        return r;
    }
}