import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.math.BigInteger; BigInteger java.math import java.util.*; util.* java public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} Main final int mod = 1000000007; mod 1000000007 final BigInteger MOD = BigInteger.valueOf(mod); MOD BigInteger.valueOf(mod) BigInteger.valueOf BigInteger mod static BufferedReader in; in static PrintWriter out; out static StringTokenizer tok; tok void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    } solve {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    } int N = ni(); N ni() ni int[] d1 = new int[N]; d1 new int[N] N int[] d2 = new int[N]; d2 new int[N] N for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            d1[i] = ni();
            d2[i] = ni();
        } {
            d1[i] = ni();
            d2[i] = ni();
        } d1[i] = ni() d1[i] d1 i ni() ni d2[i] = ni() d2[i] d2 i ni() ni String ans = "No"; ans "No" for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        } int i = 2; int i = 2; i 2 i < N i N i++ i++ i {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        } {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        } if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            } (d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2]) (d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2]) (d1[i]==d2[i]) d1[i] d1 i d2[i] d2 i (d1[i-1]==d2[i-1]) d1[i-1] d1 i-1 i 1 d2[i-1] d2 i-1 i 1 (d1[i-2]==d2[i-2]) d1[i-2] d1 i-2 i 2 d2[i-2] d2 i-2 i 2 {
                ans = "Yes";
            } ans = "Yes" ans "Yes" out.println(ans) out.println out ans int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    } mul {
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    } int val = (int)((x * 1L * y) % mod); val (int)((x * 1L * y) % mod) (x * 1L * y) x * 1L * y x 1L y mod return val>=0 ? val : val+mod; val>=0 ? val : val+mod val>=0 val 0 val val+mod val mod int x x int y y int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    } add {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    } x += y x y if(x < 0) x += mod; x < 0 x 0 x += mod x mod if(x>=mod) x -= mod; x>=mod x mod x -= mod x mod return x; x int x x int y y int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    } sub {
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    } x = add(x,mod-y) x add(x,mod-y) add x mod-y mod y if(x < 0) x += mod; x < 0 x 0 x += mod x mod if(x>=mod) x -= mod; x>=mod x mod x -= mod x mod return x; x int x x int y y String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    } ns {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    } while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        } !tok.hasMoreTokens() tok.hasMoreTokens() tok.hasMoreTokens tok {
            tok = new StringTokenizer(in.readLine(), " ");
        } tok = new StringTokenizer(in.readLine(), " ") tok new StringTokenizer(in.readLine(), " ") return tok.nextToken(); tok.nextToken() tok.nextToken tok int ni() throws IOException {
        return Integer.parseInt(ns());
    } ni {
        return Integer.parseInt(ns());
    } return Integer.parseInt(ns()); Integer.parseInt(ns()) Integer.parseInt Integer ns() ns long nl() throws IOException {
        return Long.parseLong(ns());
    } nl {
        return Long.parseLong(ns());
    } return Long.parseLong(ns()); Long.parseLong(ns()) Long.parseLong Long ns() ns double nd() throws IOException {
        return Double.parseDouble(ns());
    } nd {
        return Double.parseDouble(ns());
    } return Double.parseDouble(ns()); Double.parseDouble(ns()) Double.parseDouble Double ns() ns String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    } nsa {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    } String[] res = new String[n]; res new String[n] n for (int i = 0; i < n; i++) {
            res[i] = ns();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            res[i] = ns();
        } {
            res[i] = ns();
        } res[i] = ns() res[i] res i ns() ns return res; res int n n int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    } nia {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    } int[] res = new int[n]; res new int[n] n for (int i = 0; i < n; i++) {
            res[i] = ni();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            res[i] = ni();
        } {
            res[i] = ni();
        } res[i] = ni() res[i] res i ni() ni return res; res int n n long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    } nla {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    } long[] res = new long[n]; res new long[n] n for (int i = 0; i < n; i++) {
            res[i] = nl();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            res[i] = nl();
        } {
            res[i] = nl();
        } res[i] = nl() res[i] res i nl() nl return res; res int n n public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    } main {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    } in = new BufferedReader(new InputStreamReader(System.in)) in new BufferedReader(new InputStreamReader(System.in)) out = new PrintWriter(System.out) out new PrintWriter(System.out) tok = new StringTokenizer("") tok new StringTokenizer("") Main main = new Main(); main new Main() main.solve() main.solve main out.close() out.close out String[] args args public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
 
public class Main {
 
    void solve() throws IOException {
        int N = ni();
        int[] d1 = new int[N];
        int[] d2 = new int[N];
        
        for (int i = 0; i < N; i++) {
            d1[i] = ni();
            d2[i] = ni();
        }
        String ans = "No";
        for (int i = 2; i < N; i++) {
            if((d1[i]==d2[i])&&(d1[i-1]==d2[i-1])&&(d1[i-2]==d2[i-2])){
                ans = "Yes";
            }
        }
 
        out.println(ans);
    }

    final int mod = 1000000007;
    final BigInteger MOD = BigInteger.valueOf(mod);

    int mul(int x, int y){
        int val = (int)((x * 1L * y) % mod);
        return val>=0 ? val : val+mod;
    }
    int add(int x, int y) {
        x += y;
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    int sub(int x, int y){
        x = add(x,mod-y);
        if(x < 0) x += mod;
        if(x>=mod) x -= mod;
        return x;
    }
    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }
 
    int ni() throws IOException {
        return Integer.parseInt(ns());
    }
 
    long nl() throws IOException {
        return Long.parseLong(ns());
    }
 
    double nd() throws IOException {
        return Double.parseDouble(ns());
    }
 
    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }
 
    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }
 
    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }
 
    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;
 
    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}