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

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    }
}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(String s) {
        try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

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

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

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.FileNotFoundException; FileNotFoundException java.io import java.io.FileReader; FileReader 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 {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    }
} Main public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    } main {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    } FastScanner scanner = new FastScanner(); scanner new FastScanner() String s = ""; s "" int[] set = new int[scanner.nextInt()]; set new int[scanner.nextInt()] scanner.nextInt() scanner.nextInt scanner for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        } int i = 0; int i = 0; i 0 i < set.length i set.length set set.length i++ i++ i {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        } {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        } int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1; a == scanner.nextInt() a scanner.nextInt() scanner.nextInt scanner if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1; i != 0 i 0 set[i] = set[i - 1] + 1 set[i] set i set[i - 1] + 1 set[i - 1] set i - 1 i 1 1 set[0] = 1 set[0] set 0 1 if (set[i] == 3) {
                s = "Yes";
                break;
            } set[i] == 3 set[i] set i 3 {
                s = "Yes";
                break;
            } s = "Yes" s "Yes" break; if (!s.equals("Yes"))
            s = "No"; !s.equals("Yes") s.equals("Yes") s.equals s "Yes" s = "No" s "No" System.out.println(s) System.out.println System.out System System.out s String[] args args class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(String s) {
        try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

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

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

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }
} FastScanner BufferedReader br; br StringTokenizer st; st public FastScanner(String s) {
        try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    } FastScanner {
        try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    } try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } FileNotFoundException e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            br = new BufferedReader(new FileReader(s));
        } br = new BufferedReader(new FileReader(s)) br new BufferedReader(new FileReader(s)) String s s public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    } FastScanner {
        br = new BufferedReader(new InputStreamReader(System.in));
    } br = new BufferedReader(new InputStreamReader(System.in)) br new BufferedReader(new InputStreamReader(System.in)) String nextToken() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    } nextToken {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    } while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        } st == null || !st.hasMoreElements() st == null st null !st.hasMoreElements() st.hasMoreElements() st.hasMoreElements st {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        } 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(nextToken());
    } nextInt {
        return Integer.parseInt(nextToken());
    } return Integer.parseInt(nextToken()); Integer.parseInt(nextToken()) Integer.parseInt Integer nextToken() nextToken long nextLong() {
        return Long.parseLong(nextToken());
    } nextLong {
        return Long.parseLong(nextToken());
    } return Long.parseLong(nextToken()); Long.parseLong(nextToken()) Long.parseLong Long nextToken() nextToken double nextDouble() {
        return Double.parseDouble(nextToken());
    } nextDouble {
        return Double.parseDouble(nextToken());
    } return Double.parseDouble(nextToken()); Double.parseDouble(nextToken()) Double.parseDouble Double nextToken() nextToken public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    }
} public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    }
} Main
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        String s = "";
        int[] set = new int[scanner.nextInt()];
        for (int i = 0; i < set.length; i++) {
            int a = scanner.nextInt();
            if (a == scanner.nextInt())
                if (i != 0)
                    set[i] = set[i - 1] + 1;
                else
                    set[0] = 1;
            if (set[i] == 3) {
                s = "Yes";
                break;
            }
        }
        if (!s.equals("Yes"))
            s = "No";
        System.out.println(s);
    }
}

class FastScanner {
    BufferedReader br;
    StringTokenizer st;

    public FastScanner(String s) {
        try {
            br = new BufferedReader(new FileReader(s));
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

    public FastScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

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

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

    long nextLong() {
        return Long.parseLong(nextToken());
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }
}