import java.util.Scanner;

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

public class Main {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        int N = scn.nextInt();
        int count = 0;
        for(int i=0; i<N; i++) {
            int a = scn.nextInt();
            int b = scn.nextInt();
            if(a == b) {
                count++;
            } else {
                count = 0;
            }
            if(count == 3) {
                break;
            }
        }
        if(count == 3) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}