import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
} Main public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } main {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    } try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } Exception e {
            e.printStackTrace();
        } e.printStackTrace() e.printStackTrace e {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) int n = scanner.nextInt(); n scanner.nextInt() scanner.nextInt scanner int cnt = 0; cnt 0 String ans = "No"; ans "No" for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            } {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            } if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                } scanner.nextInt() == scanner.nextInt() scanner.nextInt() scanner.nextInt scanner scanner.nextInt() scanner.nextInt scanner {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } cnt++ cnt if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    } cnt >= 3 cnt 3 {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    } ans = "Yes" ans "Yes" System.out.println(ans) System.out.println System.out System System.out ans return; {
                    cnt = 0;
                } cnt = 0 cnt 0 System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
} public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner scanner = new Scanner(System.in);) {
            int n = scanner.nextInt();
            int cnt = 0;
            String ans = "No";

            for(int i = 0; i < n; i++) {
                if(scanner.nextInt() == scanner.nextInt()) {
                    cnt++;
                    if(cnt >= 3) {
                        ans = "Yes";
                        System.out.println(ans);
                        return;
                    }
                } else {
                    cnt = 0;
                }
            }
            
            System.out.println(ans);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
