import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
    private static FastScanner fs = new FastScanner();
    public static void main(String[] args) {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    }


    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }
        private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        }
        public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        }
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main{
    private static FastScanner fs = new FastScanner();
    public static void main(String[] args) {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    }


    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }
        private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        }
        public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        }
    }
} Main private static FastScanner fs = new FastScanner(); fs new FastScanner() public static void main(String[] args) {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    } main {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    } int n = fs.nextInt(); n fs.nextInt() fs.nextInt fs int arr[] = new int[101]; arr new int[101] 101 int flag =0; flag 0 boolean isTrue = false; isTrue false for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       } int i=3; int i=3; i 3 i<(n+3) i (n+3) n 3 i++ i++ i {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       } {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       } int a = fs.nextInt(); a fs.nextInt() fs.nextInt fs int b = fs.nextInt(); b fs.nextInt() fs.nextInt fs if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           } a==b && flag==0 a==b a b flag==0 flag 0 {
               flag=1;
           } flag=1 flag 1 if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           } flag==1 && a==b flag==1 flag 1 a==b a b {
               flag =2;
           } flag =2 flag 2 if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           } flag ==2 && a==b flag ==2 flag 2 a==b a b {
               flag =3;
               isTrue = true;
           } flag =3 flag 3 isTrue = true isTrue true if(a==b || a !=b)
           {
               flag=0;
           } a==b || a !=b a==b a b a !=b a b {
               flag=0;
           } flag=0 flag 0 if(isTrue) System.out.println("Yes");
       else System.out.println("No"); isTrue System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }
        private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        }
        public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        }
    } FastScanner BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(""); st new StringTokenizer("") String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        } next {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        } while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                } IOException e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    st = new StringTokenizer(br.readLine());
                } st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        } readArray {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        } int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) a[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        } gcd {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        } while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            } b > 0 b 0 {
                int  temp = b;
                b = a % b;
                a = temp;
            } int  temp = b; temp b b = a % b b a % b a b a = temp a temp return a; a int a a int b b private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        } upper {
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        } int low = 0; low 0 int high = arr.length-1; high arr.length-1 arr.length arr arr.length 1 while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            } low < high low high {
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            } int mid = low + (high - low+1)/2; mid low + (high - low+1)/2 low (high - low+1)/2 (high - low+1) high - low high low 1 2 if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                } arr[mid] <= key arr[mid] arr mid key {
                    low = mid;
                } low = mid low mid {
                    high = mid-1;
                } high = mid-1 high mid-1 mid 1 return low; low int arr[] arr int key key public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        } lower {
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        } int low = 0; low 0 int high = arr.length-1; high arr.length-1 arr.length arr arr.length 1 while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            } low < high low high {
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            } int mid = low + (high - low)/2; mid low + (high - low)/2 low (high - low)/2 (high - low) high low 2 if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                } arr[mid] >= key arr[mid] arr mid key {
                    high = mid;
                } high = mid high mid {
                    low = mid+1;
                } low = mid+1 low mid+1 mid 1 return low; low int arr[] arr int key key public class Main{
    private static FastScanner fs = new FastScanner();
    public static void main(String[] args) {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    }


    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }
        private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        }
        public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        }
    }
} public class Main{
    private static FastScanner fs = new FastScanner();
    public static void main(String[] args) {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    }


    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }
        private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        }
        public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        }
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{
    private static FastScanner fs = new FastScanner();
    public static void main(String[] args) {

       int n = fs.nextInt();
       int arr[] = new int[101];
       int flag =0;
       boolean isTrue = false;
       for(int i=3;i<(n+3);i++)
       {
           int a = fs.nextInt();
           int b = fs.nextInt();
           if(a==b && flag==0)
           {
               flag=1;
           }
           else if(flag==1 && a==b)
           {
               flag =2;
           }
           else if(flag ==2 && a==b)
           {
               flag =3;
               isTrue = true;
           }
           else if(a==b || a !=b)
           {
               flag=0;
           }
       }
       if(isTrue) System.out.println("Yes");
       else System.out.println("No");
    }


    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        long nextLong() {
            return Long.parseLong(next());
        }
        int  gcd(int a,int b)
        {
            while (b > 0)
            {
                int  temp = b;
                b = a % b;
                a = temp;
            }
            return a;
        }
        private int upper(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low+1)/2;
                if(arr[mid] <= key){
                    low = mid;
                }
                else{
                    high = mid-1;
                }
            }
            return low;
        }
        public int lower(int arr[],int key){
            int low = 0;
            int high = arr.length-1;
            while(low < high){
                int mid = low + (high - low)/2;
                if(arr[mid] >= key){
                    high = mid;
                }
                else{
                    low = mid+1;
                }
            }
            return low;
        }
    }
}