import java.io.*;
import java.util.*;

class Main {
	public static void main(String[] $) {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		boolean ans=false;
		int[][] D=new int[N][2];
		for (int i=0;i<N;++i) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		for (int i=0;i+2<N;++i) {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		}
		System.out.println(ans?"Yes":"No");
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
} import java.io.*; io.* java import java.util.*; util.* java class Main {
	public static void main(String[] $) {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		boolean ans=false;
		int[][] D=new int[N][2];
		for (int i=0;i<N;++i) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		for (int i=0;i+2<N;++i) {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		}
		System.out.println(ans?"Yes":"No");
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
} Main public static void main(String[] $) {
		new Main().run();
	} main {
		new Main().run();
	} new Main().run() new Main().run new Main() String[] $ $ void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		boolean ans=false;
		int[][] D=new int[N][2];
		for (int i=0;i<N;++i) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		for (int i=0;i+2<N;++i) {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		}
		System.out.println(ans?"Yes":"No");
	} run {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		boolean ans=false;
		int[][] D=new int[N][2];
		for (int i=0;i<N;++i) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		for (int i=0;i+2<N;++i) {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		}
		System.out.println(ans?"Yes":"No");
	} Scanner sc=new Scanner(System.in); sc new Scanner(System.in) int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc boolean ans=false; ans false int[][] D=new int[N][2]; D new int[N][2] N 2 for (int i=0;i<N;++i) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		} int i=0; int i=0; i 0 i<N i N ++i ++i i {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		} {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		} D[i][0]=sc.nextInt() D[i][0] D[i] D i 0 sc.nextInt() sc.nextInt sc D[i][1]=sc.nextInt() D[i][1] D[i] D i 1 sc.nextInt() sc.nextInt sc for (int i=0;i+2<N;++i) {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		} int i=0; int i=0; i 0 i+2<N i+2 i 2 N ++i ++i i {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		} {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		} ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1] ans D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1] D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1] D[i][0]==D[i][1] D[i][0] D[i] D i 0 D[i][1] D[i] D i 1 D[i+1][0]==D[i+1][1] D[i+1][0] D[i+1] D i+1 i 1 0 D[i+1][1] D[i+1] D i+1 i 1 1 D[i+2][0]==D[i+2][1] D[i+2][0] D[i+2] D i+2 i 2 0 D[i+2][1] D[i+2] D i+2 i 2 1 System.out.println(ans?"Yes":"No") System.out.println System.out System System.out ans?"Yes":"No" ans "Yes" "No" void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));} tr {System.out.println(Arrays.deepToString(objects));} System.out.println(Arrays.deepToString(objects)) System.out.println System.out System System.out Arrays.deepToString(objects) Arrays.deepToString Arrays objects Object...objects objects
import java.io.*;
import java.util.*;

class Main {
	public static void main(String[] $) {
		new Main().run();
	}
	
	void run() {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		boolean ans=false;
		int[][] D=new int[N][2];
		for (int i=0;i<N;++i) {
			D[i][0]=sc.nextInt();
			D[i][1]=sc.nextInt();
		}
		for (int i=0;i+2<N;++i) {
			ans|=D[i][0]==D[i][1]&&D[i+1][0]==D[i+1][1]&&D[i+2][0]==D[i+2][1];
		}
		System.out.println(ans?"Yes":"No");
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}
