import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;


public class Main {
    static int smallest = 0;
    final static long MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    }

    public static int gcd (int a, int b) {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    }

    public static String rString(String s) {
        return new StringBuilder(s).reverse().toString();
    }

    public static long modpow(long exp, long pow) {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    }

    public static int powoftwo(long n){
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    }

    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }

}




 import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.lang.reflect.Array; Array java.lang.reflect import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java public class Main {
    static int smallest = 0;
    final static long MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    }

    public static int gcd (int a, int b) {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    }

    public static String rString(String s) {
        return new StringBuilder(s).reverse().toString();
    }

    public static long modpow(long exp, long pow) {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    }

    public static int powoftwo(long n){
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    }

    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }

} Main static int smallest = 0; smallest 0 final static long MOD = 1000000007; MOD 1000000007 public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    } main {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    } FastScanner fs = new FastScanner(); fs new FastScanner() PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) int n = fs.nextInt(); n fs.nextInt() fs.nextInt fs int [][] d = new int[n][2]; d new int[n][2] n 2 for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            d[i] = fs.nextIntArray(2);
        } {
            d[i] = fs.nextIntArray(2);
        } d[i] = fs.nextIntArray(2) d[i] d i fs.nextIntArray(2) fs.nextIntArray fs 2 boolean true_ar [] = new boolean[n]; true_ar new boolean[n] n for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            true_ar[i] = d[i][0] == d[i][1];
        } {
            true_ar[i] = d[i][0] == d[i][1];
        } true_ar[i] = d[i][0] == d[i][1] true_ar[i] true_ar i d[i][0] == d[i][1] d[i][0] d[i] d i 0 d[i][1] d[i] d i 1 int len = 0; len 0 int maxlen = 0; maxlen 0 for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        } {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        } if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            } true_ar[i] true_ar i {
                len++;
                maxlen = Math.max(len, maxlen);
            } len++ len maxlen = Math.max(len, maxlen) maxlen Math.max(len, maxlen) Math.max Math len maxlen {
                len = 0;
            } len = 0 len 0 if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        } maxlen >= 3 maxlen 3 {
            out.println("Yes");
        } out.println("Yes") out.println out "Yes" {
            out.println("No");
        } out.println("No") out.println out "No" out.flush() out.flush out out.close() out.close out String[] args args public static int gcd (int a, int b) {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    } gcd {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    } BigInteger aa = BigInteger.valueOf(a); aa BigInteger.valueOf(a) BigInteger.valueOf BigInteger a BigInteger bb = BigInteger.valueOf(b); bb BigInteger.valueOf(b) BigInteger.valueOf BigInteger b return (int)aa.gcd(bb).longValue(); (int)aa.gcd(bb).longValue() aa.gcd(bb).longValue aa.gcd(bb) aa.gcd aa bb int a a int b b public static String rString(String s) {
        return new StringBuilder(s).reverse().toString();
    } rString {
        return new StringBuilder(s).reverse().toString();
    } return new StringBuilder(s).reverse().toString(); new StringBuilder(s).reverse().toString() new StringBuilder(s).reverse().toString new StringBuilder(s).reverse() new StringBuilder(s).reverse new StringBuilder(s) String s s public static long modpow(long exp, long pow) {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    } modpow {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    } BigInteger exp_b = BigInteger.valueOf(exp); exp_b BigInteger.valueOf(exp) BigInteger.valueOf BigInteger exp BigInteger pow_b = BigInteger.valueOf(pow); pow_b BigInteger.valueOf(pow) BigInteger.valueOf BigInteger pow return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue(); exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue() exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue exp_b.modPow(pow_b, BigInteger.valueOf(MOD)) exp_b.modPow exp_b pow_b BigInteger.valueOf(MOD) BigInteger.valueOf BigInteger MOD long exp exp long pow pow public static int powoftwo(long n){
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    } powoftwo {
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    } int count = 0; count 0 while(n != 0) {
            n >>= 1;
            count++;
        } n != 0 n 0 {
            n >>= 1;
            count++;
        } n >>= 1 n 1 count++ count return count - 1; count - 1 count 1 long n n public static void rotate(int[] nums, int k) {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    } rotate {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    } int n = nums.length; n nums.length nums nums.length if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        } k > 0 k 0 {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        } for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            } int j = 0; int j = 0; j 0 j < k j k j++ j++ j {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            } {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            } for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                } {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                } int temp = nums[(i + k) % n]; temp nums[(i + k) % n] nums (i + k) % n (i + k) i k n nums[(i + k) % n] = nums[i] nums[(i + k) % n] nums (i + k) % n (i + k) i k n nums[i] nums i nums[i] = temp nums[i] nums i temp int[] nums nums int k k static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    } FastScanner BufferedReader br; br StringTokenizer st; st public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        } FastScanner {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        } try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            } Exception e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) st = new StringTokenizer("") st new StringTokenizer("") public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        } next {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        } if (st.hasMoreTokens())
                return st.nextToken(); st.hasMoreTokens() st.hasMoreTokens st return st.nextToken(); st.nextToken() st.nextToken st try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            } Exception 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 public int nextInt() {
            return Integer.parseInt(next());
        } nextInt {
            return Integer.parseInt(next());
        } return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next public long nextLong() {
            return Long.parseLong(next());
        } nextLong {
            return Long.parseLong(next());
        } return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next public double nextDouble() {
            return Double.parseDouble(next());
        } nextDouble {
            return Double.parseDouble(next());
        } return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        } nextLine {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        } String line = ""; line "" try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            } catch (Exception e) {
                e.printStackTrace();
            } Exception e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                line = br.readLine();
            } line = br.readLine() line br.readLine() br.readLine br return line; line public char nextChar() {
            return next().charAt(0);
        } nextChar {
            return next().charAt(0);
        } return next().charAt(0); next().charAt(0) next().charAt next() next 0 public Integer[] nextIntegerArray(int n) {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        } nextIntegerArray {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        } Integer[] a = new Integer[n]; a new Integer[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 public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        } nextIntArray {
            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 public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        } nextLongArray {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        } long[] a = new long[n]; a new long[n] n for (int i = 0; i < n; i++)
                a[i] = nextLong(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextLong(); a[i] = nextLong() a[i] a i nextLong() nextLong return a; a int n n public char[] nextCharArray() {
            return nextLine().toCharArray();
        } nextCharArray {
            return nextLine().toCharArray();
        } return nextLine().toCharArray(); nextLine().toCharArray() nextLine().toCharArray nextLine() nextLine public class Main {
    static int smallest = 0;
    final static long MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    }

    public static int gcd (int a, int b) {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    }

    public static String rString(String s) {
        return new StringBuilder(s).reverse().toString();
    }

    public static long modpow(long exp, long pow) {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    }

    public static int powoftwo(long n){
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    }

    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }

} public class Main {
    static int smallest = 0;
    final static long MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    }

    public static int gcd (int a, int b) {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    }

    public static String rString(String s) {
        return new StringBuilder(s).reverse().toString();
    }

    public static long modpow(long exp, long pow) {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    }

    public static int powoftwo(long n){
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    }

    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;


public class Main {
    static int smallest = 0;
    final static long MOD = 1000000007;

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
       //out.println();
       int n = fs.nextInt();

       int [][] d = new int[n][2];

        for (int i = 0; i < n; i++) {
            d[i] = fs.nextIntArray(2);
        }

        boolean true_ar [] = new boolean[n];

        for (int i = 0; i < n; i++) {
            true_ar[i] = d[i][0] == d[i][1];
        }

        int len = 0;
        int maxlen = 0;
        for(int i = 0; i < n; i++) {
            if(true_ar[i]) {
                len++;
                maxlen = Math.max(len, maxlen);
            } else {
                len = 0;
            }
        }

        if(maxlen >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }

        out.flush();
        out.close();
    }

    public static int gcd (int a, int b) {
        BigInteger aa = BigInteger.valueOf(a);
        BigInteger bb = BigInteger.valueOf(b);
        return (int)aa.gcd(bb).longValue();
    }

    public static String rString(String s) {
        return new StringBuilder(s).reverse().toString();
    }

    public static long modpow(long exp, long pow) {
        BigInteger exp_b = BigInteger.valueOf(exp);
        BigInteger pow_b = BigInteger.valueOf(pow);
        return exp_b.modPow(pow_b, BigInteger.valueOf(MOD)).longValue();
    }

    public static int powoftwo(long n){
        int count = 0;
        while(n != 0) {
            n >>= 1;
            count++;
        }
        return count - 1;
    }

    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        if(k > 0) {
            for(int j = 0; j < k; j++) {
                for (int i = 0; i < n; i++) {
                    int temp = nums[(i + k) % n];
                    nums[(i + k) % n] = nums[i];
                    nums[i] = temp;
                }
            }
        }
    }


    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                // br = new BufferedReader(new FileReader("chat.txt"));
                st = new StringTokenizer("");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        public String next() {
            if (st.hasMoreTokens())
                return st.nextToken();
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return st.nextToken();
        }

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

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            String line = "";
            try {
                line = br.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return line;
        }

        public char nextChar() {
            return next().charAt(0);
        }

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

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

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }

        public char[] nextCharArray() {
            return nextLine().toCharArray();
        }
    }

}





