import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isThree = false;
        int count = 0;
        int d1,d2;
        for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        }
        System.out.print(isThree ? "Yes" : "No");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isThree = false;
        int count = 0;
        int d1,d2;
        for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        }
        System.out.print(isThree ? "Yes" : "No");
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isThree = false;
        int count = 0;
        int d1,d2;
        for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        }
        System.out.print(isThree ? "Yes" : "No");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isThree = false;
        int count = 0;
        int d1,d2;
        for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        }
        System.out.print(isThree ? "Yes" : "No");
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc boolean isThree = false; isThree false int count = 0; count 0 int d1 d1 d2; d2 for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        } {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        } d1 = sc.nextInt() d1 sc.nextInt() sc.nextInt sc d2 = sc.nextInt() d2 sc.nextInt() sc.nextInt sc if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            } d1 == d2 d1 d2 {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } count++ count if (count == 3) {
                    isThree = true;
                } count == 3 count 3 {
                    isThree = true;
                } isThree = true isThree true {
                count = 0;
            } count = 0 count 0 System.out.print(isThree ? "Yes" : "No") System.out.print System.out System System.out isThree ? "Yes" : "No" isThree "Yes" "No" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isThree = false;
        int count = 0;
        int d1,d2;
        for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        }
        System.out.print(isThree ? "Yes" : "No");
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean isThree = false;
        int count = 0;
        int d1,d2;
        for (int i=0; i<n; i++) {
            d1 = sc.nextInt();
            d2 = sc.nextInt();
            if (d1 == d2) {
                count++;
                if (count == 3) {
                    isThree = true;
                }
            } else {
                count = 0;
            }
        }
        System.out.print(isThree ? "Yes" : "No");
    }
} Main
import java.util.*;

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