import java.io.DataInputStream;
import java.io.IOException;

class Main {

    final private static int BUFFER_SIZE = 1 << 16;
    private static DataInputStream din;
    private static byte[] buffer;
    private static int bufferPointer, bytesRead;

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        int n = reader.nextInt();
        int counter = 0;
        String ans = "No";

        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        }

        System.out.println(ans);
    }

    static class Reader {

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }

    }
} import java.io.DataInputStream; DataInputStream java.io import java.io.IOException; IOException java.io class Main {

    final private static int BUFFER_SIZE = 1 << 16;
    private static DataInputStream din;
    private static byte[] buffer;
    private static int bufferPointer, bytesRead;

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        int n = reader.nextInt();
        int counter = 0;
        String ans = "No";

        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        }

        System.out.println(ans);
    }

    static class Reader {

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }

    }
} Main final private static int BUFFER_SIZE = 1 << 16; BUFFER_SIZE 1 << 16 1 16 private static DataInputStream din; din private static byte[] buffer; buffer private static int bufferPointer bufferPointer bytesRead; bytesRead public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        int n = reader.nextInt();
        int counter = 0;
        String ans = "No";

        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        }

        System.out.println(ans);
    } main {
        Reader reader = new Reader();
        int n = reader.nextInt();
        int counter = 0;
        String ans = "No";

        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        }

        System.out.println(ans);
    } Reader reader = new Reader(); reader new Reader() int n = reader.nextInt(); n reader.nextInt() reader.nextInt reader int counter = 0; counter 0 String ans = "No"; ans "No" for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        } {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        } int a = reader.nextInt(); a reader.nextInt() reader.nextInt reader int b = reader.nextInt(); b reader.nextInt() reader.nextInt reader if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            } counter >= 2 && (a == b) counter >= 2 counter 2 (a == b) a b {
                ans = "Yes";
                continue;
            } ans = "Yes" ans "Yes" continue; if (a != b) {
                counter = 0;
            } else {
                counter++;
            } a != b a b {
                counter = 0;
            } counter = 0 counter 0 {
                counter++;
            } counter++ counter System.out.println(ans) System.out.println System.out System System.out ans String[] args args static class Reader {

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }

    } Reader public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        } Reader {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        } din = new DataInputStream(System.in) din new DataInputStream(System.in) buffer = new byte[BUFFER_SIZE] buffer new byte[BUFFER_SIZE] BUFFER_SIZE bufferPointer = bytesRead = 0 bufferPointer bytesRead = 0 bytesRead 0 public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        } nextInt {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        } int ret = 0; ret 0 byte c = read(); c read() read while (c <= ' ')
                c = read(); c <= ' ' c ' ' c = read() c read() read boolean neg = (c == '-'); neg (c == '-') c '-' if (neg)
                c = read(); neg c = read() c read() read do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9'); (c = read()) >= '0' && c <= '9' (c = read()) >= '0' (c = read()) c read() read '0' c <= '9' c '9' {
                ret = ret * 10 + c - '0';
            } ret = ret * 10 + c - '0' ret ret * 10 + c - '0' ret * 10 + c ret * 10 ret 10 c '0' if (neg)
                return -ret; neg return -ret; -ret ret return ret; ret public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        } readLine {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        } byte[] buf = new byte[1000]; buf new byte[1000] 1000 int cnt = 0 cnt 0 c; c while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            } (c = read()) != -1 (c = read()) c read() read -1 1 {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            } if (c == '\n')
                    break; c == '\n' c '\n' break; buf[cnt++] = (byte) c buf[cnt++] buf cnt++ cnt (byte) c return new String(buf, 0, cnt); new String(buf, 0, cnt) private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        } fillBuffer {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        } bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE) bytesRead din.read(buffer, bufferPointer = 0, BUFFER_SIZE) din.read din buffer bufferPointer = 0 bufferPointer 0 BUFFER_SIZE if (bytesRead == -1)
                buffer[0] = -1; bytesRead == -1 bytesRead -1 1 buffer[0] = -1 buffer[0] buffer 0 -1 1 private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        } read {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        } if (bufferPointer == bytesRead)
                fillBuffer(); bufferPointer == bytesRead bufferPointer bytesRead fillBuffer() fillBuffer return buffer[bufferPointer++]; buffer[bufferPointer++] buffer bufferPointer++ bufferPointer public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        } close {
            if (din == null)
                return;
            din.close();
        } if (din == null)
                return; din == null din null return; din.close() din.close din
import java.io.DataInputStream;
import java.io.IOException;

class Main {

    final private static int BUFFER_SIZE = 1 << 16;
    private static DataInputStream din;
    private static byte[] buffer;
    private static int bufferPointer, bytesRead;

    public static void main(String[] args) throws IOException {
        Reader reader = new Reader();
        int n = reader.nextInt();
        int counter = 0;
        String ans = "No";

        for (int i = 0; i < n; i++) {
            int a = reader.nextInt();
            int b = reader.nextInt();

            if (counter >= 2 && (a == b)) {
                ans = "Yes";
                continue;
            } else if (a != b) {
                counter = 0;
            } else {
                counter++;
            }
        }

        System.out.println(ans);
    }

    static class Reader {

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[1000]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }

    }
}