import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("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();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int count = 0; count 0 boolean key = false; key false for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        } {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        } int D1 = sc.nextInt(); D1 sc.nextInt() sc.nextInt sc int D2 = sc.nextInt(); D2 sc.nextInt() sc.nextInt sc if (D1 == D2) {
                count++;
            } else {
                count = 0;
            } D1 == D2 D1 D2 {
                count++;
            } count++ count {
                count = 0;
            } count = 0 count 0 if (count == 3) {
                key = true;
            } count == 3 count 3 {
                key = true;
            } key = true key true if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } key {
            System.out.println("Yes");
        } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
            System.out.println("No");
        } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        boolean key = false;
        for (int i = 0; i < N; i++) {
            int D1 = sc.nextInt();
            int D2 = sc.nextInt();
            if (D1 == D2) {
                count++;
            } else {
                count = 0;
            }
            if (count == 3) {
                key = true;
            }
        }
        if (key) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}