/*
    Author: Anthony Ngene
    Created: 19/09/2020 - 13:04
*/

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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    }
} import java.io.*; io.* java import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in boolean isValid = false; isValid false int count = 0; count 0 for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        } {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        } int a = in.nextInt() a in.nextInt() in.nextInt in b = in.nextInt(); b in.nextInt() in.nextInt in if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            } a == b a b {
                count++;
                if (count >= 3)
                    isValid = true;
            } count++ count if (count >= 3)
                    isValid = true; count >= 3 count 3 isValid = true isValid true {
                count = 0;
            } count = 0 count 0 System.out.println(isValid ? "Yes" : "No") System.out.println System.out System System.out isValid ? "Yes" : "No" isValid "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    }
} Main
/*
    Author: Anthony Ngene
    Created: 19/09/2020 - 13:04
*/

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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        boolean isValid = false;
        int count = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt(), b = in.nextInt();
            if (a == b) {
                count++;
                if (count >= 3)
                    isValid = true;
            } else {
                count = 0;
            }
        }
        System.out.println(isValid ? "Yes" : "No");
    }
}
