import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    }
} import java.util.*; util.* java import java.io.*; io.* java public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    }
} Main public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    } main {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    } final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); bw new BufferedWriter(new OutputStreamWriter(System.out)) final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br boolean res = false; res false for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        } int i = 0, chain = 0; int i = 0 i 0 chain = 0; chain 0 i < n i n ++i ++i i {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        } {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        } String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int a = Integer.parseInt(line[0]) a Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 b = Integer.parseInt(line[1]); b Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            } a == b a b {
                res |= ++chain >= 3;
            } res |= ++chain >= 3 res ++chain >= 3 ++chain chain 3 {
                chain = 0;
            } chain = 0 chain 0 bw.write(res ? "Yes" : "No") bw.write bw res ? "Yes" : "No" res "Yes" "No" bw.close() bw.close bw br.close() br.close br String[] args args public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    }
} Main
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws IOException {
        final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        boolean res = false;

        for (int i = 0, chain = 0; i < n; ++i) {
            String[] line = br.readLine().split(" ");
            int a = Integer.parseInt(line[0]), b = Integer.parseInt(line[1]);
            if (a == b) {
                res |= ++chain >= 3;
            } else {
                chain = 0;
            }
        }

        bw.write(res ? "Yes" : "No");

        bw.close();
        br.close();
    }
}
