import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    }

    private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    }

    private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner List<int[]> examples = new ArrayList<>(); examples new ArrayList<>() for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        } {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        } int[] ints = new int[2]; ints new int[2] 2 ints[0] = scanner.nextInt() ints[0] ints 0 scanner.nextInt() scanner.nextInt scanner ints[1] = scanner.nextInt() ints[1] ints 1 scanner.nextInt() scanner.nextInt scanner examples.add(ints) examples.add examples ints judge(examples) judge examples String[] args args private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } judge {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    } int count = 0; count 0 for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        } int[] item examples {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        } {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        } if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            } item[0] == item[1] item[0] item 0 item[1] item 1 {
                count++;
            } count++ count {
                count = 0;
            } count = 0 count 0 if (count == 3) {
                System.out.println("Yes");
                return;
            } count == 3 count 3 {
                System.out.println("Yes");
                return;
            } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; System.out.println("No") System.out.println System.out System System.out "No" List<int[]> examples examples public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    }

    private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    }

    private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
} Main
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        List<int[]> examples = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int[] ints = new int[2];
            ints[0] = scanner.nextInt();
            ints[1] = scanner.nextInt();
            examples.add(ints);
        }
        judge(examples);
    }

    private static void judge(List<int[]> examples) {
        int count = 0;
        for (int[] item: examples) {
            if (item[0] == item[1]) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                System.out.println("Yes");
                return;
            }
        }
        System.out.println("No");
    }
}