import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            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);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } main {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc int num = Integer.parseInt(line); num Integer.parseInt(line) Integer.parseInt Integer line int count = 0; count 0 boolean ret = false; ret false for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        } int i = 0; int i = 0; i 0 i < num i num i++ i++ i {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        } {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        } line = sc.nextLine() line sc.nextLine() sc.nextLine sc String[] lines = line.split(" ", 0); lines line.split(" ", 0) line.split line " " 0 int a = Integer.parseInt(lines[0]); a Integer.parseInt(lines[0]) Integer.parseInt Integer lines[0] lines 0 int b = Integer.parseInt(lines[1]); b Integer.parseInt(lines[1]) Integer.parseInt Integer lines[1] lines 1 if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            } a == b a b {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } count++ count if (count == 3) {
                    ret = true;
                } count == 3 count 3 {
                    ret = true;
                } ret = true ret true {
                count = 0;
            } count = 0 count 0 if (ret) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        } ret {
            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);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            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);
        String line = sc.nextLine();
        int num = Integer.parseInt(line);

        int count = 0;
        boolean ret = false;
        for (int i = 0; i < num; i++) {
            line = sc.nextLine();
            String[] lines = line.split(" ", 0);
            int a = Integer.parseInt(lines[0]);
            int b = Integer.parseInt(lines[1]);
            if (a == b) {
                count++;
                if (count == 3) {
                    ret = true;
                }
            } else {
                count = 0;
            }
        }

        if (ret) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}