import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    void solve(Scanner in, PrintWriter out) {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
} import java.io.PrintWriter; PrintWriter java.io import java.util.Arrays; Arrays java.util import java.util.HashSet; HashSet java.util import java.util.Scanner; Scanner java.util import java.util.Set; Set java.util public class Main {

    void solve(Scanner in, PrintWriter out) {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
} Main void solve(Scanner in, PrintWriter out) {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    } solve {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    } int t = in.nextInt(); t in.nextInt() in.nextInt in int cpt = 0; cpt 0 for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        } int i = 0; int i = 0; i 0 i < t i t ++i ++i i {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        } {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        } int a1 = in.nextInt(); a1 in.nextInt() in.nextInt in int b1 = in.nextInt(); b1 in.nextInt() in.nextInt in if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            } a1 == b1 a1 b1 {
                cpt++;
            } cpt++ cpt {
                cpt = 0;
            } cpt = 0 cpt 0 if (cpt == 3) {
                out.println("Yes");
                break;
            } cpt == 3 cpt 3 {
                out.println("Yes");
                break;
            } out.println("Yes") out.println out "Yes" break; if (cpt != 3)
            out.println("No"); cpt != 3 cpt 3 out.println("No") out.println out "No" Scanner in in PrintWriter out out public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    } main {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    } try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        } {
            new Main().solve(in, out);
        } Scanner in = new Scanner(System.in) Scanner in = new Scanner(System.in) new Scanner(System.in) PrintWriter out = new PrintWriter(System.out) PrintWriter out = new PrintWriter(System.out) new PrintWriter(System.out) new Main().solve(in, out) new Main().solve new Main() in out String[] args args public class Main {

    void solve(Scanner in, PrintWriter out) {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
} public class Main {

    void solve(Scanner in, PrintWriter out) {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
} Main
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    void solve(Scanner in, PrintWriter out) {
        int t = in.nextInt();
        int cpt = 0;

        for (int i = 0; i < t; ++i) {
            int a1 = in.nextInt();
            int b1 = in.nextInt();
            if (a1 == b1) {
                cpt++;
            } else {
                cpt = 0;
            }

            if (cpt == 3) {
                out.println("Yes");
                break;
            }
        }
        if (cpt != 3)
            out.println("No");
    }

    public static void main(String[] args) {
        try(Scanner in = new Scanner(System.in);
            PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
        }
    }
}
