import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
    public static void main(String[] args)
    {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    static class Pair{
        int x,y;
        Pair(int a, int b){
            x=a;
            y=b;
        }
    }
    /*****************************************************************************/
    static class CP
    {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;
        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }
        int nextInt() {
            return Integer.parseInt(NNNN());
        }
        long nextLong() {
            return Long.parseLong(NNNN());
        }
        double nextDouble() {
            return Double.parseDouble(NNNN());
        }
        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }
        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main
{
    public static void main(String[] args)
    {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    static class Pair{
        int x,y;
        Pair(int a, int b){
            x=a;
            y=b;
        }
    }
    /*****************************************************************************/
    static class CP
    {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;
        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }
        int nextInt() {
            return Integer.parseInt(NNNN());
        }
        long nextLong() {
            return Long.parseLong(NNNN());
        }
        double nextDouble() {
            return Double.parseDouble(NNNN());
        }
        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }
        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} Main public static void main(String[] args)
    {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    } main {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    } CP sc =new CP(); sc new CP() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc Pair[] p = new Pair[n]; p new Pair[n] n for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        } {
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        } p[i] = new Pair(sc.nextInt(), sc.nextInt()) p[i] p i new Pair(sc.nextInt(), sc.nextInt()) boolean flag = true; flag true for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        } int i=0; int i=0; i 0 i<n-2 i n-2 n 2 i++ i++ i {
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        } {
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        } if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            } p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y p[i].x==p[i].y p[i].x p[i] p i p[i].x p[i].y p[i] p i p[i].y p[i+1].x==p[i+1].y p[i+1].x p[i+1] p i+1 i 1 p[i+1].x p[i+1].y p[i+1] p i+1 i 1 p[i+1].y p[i+2].x==p[i+2].y p[i+2].x p[i+2] p i+2 i 2 p[i+2].x p[i+2].y p[i+2] p i+2 i 2 p[i+2].y {
                flag = false;
                break;
            } flag = false flag false break; if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No"); !flag flag System.out.println("Yes") System.out.println System.out System System.out "Yes" System.out.println("No") System.out.println System.out System System.out "No" String[] args args static class Pair{
        int x,y;
        Pair(int a, int b){
            x=a;
            y=b;
        }
    } Pair int x x y; y Pair(int a, int b){
            x=a;
            y=b;
        } Pair {
            x=a;
            y=b;
        } x=a x a y=b y b int a a int b b static class CP
    {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;
        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }
        int nextInt() {
            return Integer.parseInt(NNNN());
        }
        long nextLong() {
            return Long.parseLong(NNNN());
        }
        double nextDouble() {
            return Double.parseDouble(NNNN());
        }
        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }
        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    } CP BufferedReader bufferedReader; bufferedReader StringTokenizer stringTokenizer; stringTokenizer public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        } CP {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        } bufferedReader = new BufferedReader(new InputStreamReader(System.in)) bufferedReader new BufferedReader(new InputStreamReader(System.in)) int nextInt() {
            return Integer.parseInt(NNNN());
        } nextInt {
            return Integer.parseInt(NNNN());
        } return Integer.parseInt(NNNN()); Integer.parseInt(NNNN()) Integer.parseInt Integer NNNN() NNNN long nextLong() {
            return Long.parseLong(NNNN());
        } nextLong {
            return Long.parseLong(NNNN());
        } return Long.parseLong(NNNN()); Long.parseLong(NNNN()) Long.parseLong Long NNNN() NNNN double nextDouble() {
            return Double.parseDouble(NNNN());
        } nextDouble {
            return Double.parseDouble(NNNN());
        } return Double.parseDouble(NNNN()); Double.parseDouble(NNNN()) Double.parseDouble Double NNNN() NNNN String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        } NNNN {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        } while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            } stringTokenizer == null || !stringTokenizer.hasMoreElements() stringTokenizer == null stringTokenizer null !stringTokenizer.hasMoreElements() stringTokenizer.hasMoreElements() stringTokenizer.hasMoreElements stringTokenizer {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            } try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                } catch (IOException  e) {
                    e.printStackTrace();
                } IOException  e {
                    e.printStackTrace();
                } e.printStackTrace() e.printStackTrace e {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                } stringTokenizer = new StringTokenizer(bufferedReader.readLine()) stringTokenizer new StringTokenizer(bufferedReader.readLine()) return stringTokenizer.nextToken(); stringTokenizer.nextToken() stringTokenizer.nextToken stringTokenizer String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        } nextLine {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        } String spl = ""; spl "" try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } IOException e {
                e.printStackTrace();
            } e.printStackTrace() e.printStackTrace e {
                spl = bufferedReader.readLine();
            } spl = bufferedReader.readLine() spl bufferedReader.readLine() bufferedReader.readLine bufferedReader return spl; spl public class Main
{
    public static void main(String[] args)
    {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    static class Pair{
        int x,y;
        Pair(int a, int b){
            x=a;
            y=b;
        }
    }
    /*****************************************************************************/
    static class CP
    {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;
        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }
        int nextInt() {
            return Integer.parseInt(NNNN());
        }
        long nextLong() {
            return Long.parseLong(NNNN());
        }
        double nextDouble() {
            return Double.parseDouble(NNNN());
        }
        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }
        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} public class Main
{
    public static void main(String[] args)
    {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    static class Pair{
        int x,y;
        Pair(int a, int b){
            x=a;
            y=b;
        }
    }
    /*****************************************************************************/
    static class CP
    {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;
        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }
        int nextInt() {
            return Integer.parseInt(NNNN());
        }
        long nextLong() {
            return Long.parseLong(NNNN());
        }
        double nextDouble() {
            return Double.parseDouble(NNNN());
        }
        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }
        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main
{
    public static void main(String[] args)
    {
        CP sc =new CP();
        int n = sc.nextInt();
        Pair[] p = new Pair[n];
        for(int i=0;i<n;i++){
            p[i] = new Pair(sc.nextInt(), sc.nextInt());
        }
        boolean flag = true;
        for(int i=0;i<n-2;i++){
            if(p[i].x==p[i].y && p[i+1].x==p[i+1].y && p[i+2].x==p[i+2].y){
                flag = false;
                break;
            }
        }
        if(!flag)
            System.out.println("Yes");
        else
            System.out.println("No");
    }
    static class Pair{
        int x,y;
        Pair(int a, int b){
            x=a;
            y=b;
        }
    }
    /*****************************************************************************/
    static class CP
    {
        BufferedReader bufferedReader;
        StringTokenizer stringTokenizer;
        public CP() {
            bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        }
        int nextInt() {
            return Integer.parseInt(NNNN());
        }
        long nextLong() {
            return Long.parseLong(NNNN());
        }
        double nextDouble() {
            return Double.parseDouble(NNNN());
        }
        String NNNN() {
            while (stringTokenizer == null || !stringTokenizer.hasMoreElements()) {
                try {
                    stringTokenizer = new StringTokenizer(bufferedReader.readLine());
                }
                catch (IOException  e) {
                    e.printStackTrace();
                }
            }
            return stringTokenizer.nextToken();
        }
        String nextLine() {
            String spl = "";
            try {
                spl = bufferedReader.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return spl;
        }
    }
    /*****************************************************************************/
}