import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    }

} import java.io.BufferedOutputStream; BufferedOutputStream java.io import java.io.PrintWriter; PrintWriter java.io import java.util.Scanner; Scanner java.util public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    }

} Main public static PrintWriter out; out public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    } main {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) out = new PrintWriter(new BufferedOutputStream(System.out)) out new PrintWriter(new BufferedOutputStream(System.out)) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int zoromeCount = 0; zoromeCount 0 for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        } {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        } if (zoromeCount >= 3) {
                break;
            } zoromeCount >= 3 zoromeCount 3 {
                break;
            } break; int d1 = Integer.parseInt(sc.next()); d1 Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int d2 = Integer.parseInt(sc.next()); d2 Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            } d1 == d2 d1 d2 {
                zoromeCount++;
            } zoromeCount++ zoromeCount {
                zoromeCount = 0;
            } zoromeCount = 0 zoromeCount 0 if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        } zoromeCount >= 3 zoromeCount 3 {
            out.println("Yes");
        } out.println("Yes") out.println out "Yes" {
            out.println("No");
        } out.println("No") out.println out "No" sc.close() sc.close sc out.close() out.close out String[] args args public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    }

} public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    }

} Main
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static PrintWriter out;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = Integer.parseInt(sc.next());
        int zoromeCount = 0;
        for (int i = 0; i < n; i++) {
            if (zoromeCount >= 3) {
                break;
            }
            int d1 = Integer.parseInt(sc.next());
            int d2 = Integer.parseInt(sc.next());
            if (d1 == d2) {
                zoromeCount++;
            } else {
                zoromeCount = 0;
            }
        }
        if (zoromeCount >= 3) {
            out.println("Yes");
        } else {
            out.println("No");
        }
        sc.close();
        out.close();
    }

}