
// Submitted By Subhash Yadav
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io import java.math.BigDecimal; BigDecimal java.math import java.math.BigInteger; BigInteger java.math import java.math.RoundingMode; RoundingMode java.math import java.text.DecimalFormat; DecimalFormat java.text import java.util.*; util.* java import java.util.stream.IntStream; IntStream java.util.stream public class Main {

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

} Main public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	} main {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	} FastScanner sc = new FastScanner(); sc new FastScanner() PrintWriter out=new PrintWriter(System.out); out new PrintWriter(System.out) int n=sc.nextInt(); n sc.nextInt() sc.nextInt sc boolean ok=false; ok false int a[][]=new int[n][2]; a new int[n][2] n 2 for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		} {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		} a[i][0]=sc.nextInt() a[i][0] a[i] a i 0 sc.nextInt() sc.nextInt sc a[i][1]=sc.nextInt() a[i][1] a[i] a i 1 sc.nextInt() sc.nextInt sc if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			} i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1] a[i-1][0]==a[i-1][1] i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1] i>1 i 1 a[i][0]==a[i][1] a[i][0] a[i] a i 0 a[i][1] a[i] a i 1 a[i-1][0]==a[i-1][1] a[i-1][0] a[i-1] a i-1 i 1 0 a[i-1][1] a[i-1] a i-1 i 1 1 a[i-2][0]==a[i-2][1] a[i-2][0] a[i-2] a i-2 i 2 0 a[i-2][1] a[i-2] a i-2 i 2 1 {
				ok=true;
			} ok=true ok true System.out.println(ok?"Yes":"No") System.out.println System.out System System.out ok?"Yes":"No" ok "Yes" "No" String[] args args static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	} FastScanner BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st = new StringTokenizer(""); st new StringTokenizer("") String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} next {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		} while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} !st.hasMoreTokens() st.hasMoreTokens() st.hasMoreTokens st try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				} IOException e {
					e.printStackTrace();
				} e.printStackTrace() e.printStackTrace e {
					st = new StringTokenizer(br.readLine());
				} st = new StringTokenizer(br.readLine()) st new StringTokenizer(br.readLine()) return st.nextToken(); st.nextToken() st.nextToken st int nextInt() {
			return Integer.parseInt(next());
		} nextInt {
			return Integer.parseInt(next());
		} return Integer.parseInt(next()); Integer.parseInt(next()) Integer.parseInt Integer next() next int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		} readArray {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		} int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++)
				a[i] = nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = nextInt(); a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n long nextLong() {
			return Long.parseLong(next());
		} nextLong {
			return Long.parseLong(next());
		} return Long.parseLong(next()); Long.parseLong(next()) Long.parseLong Long next() next double nextDouble() {
			return Double.parseDouble(next());
		} nextDouble {
			return Double.parseDouble(next());
		} return Double.parseDouble(next()); Double.parseDouble(next()) Double.parseDouble Double next() next public class Main {

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

} public class Main {

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

} Main

// Submitted By Subhash Yadav
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) throws IOException {

		FastScanner sc = new FastScanner();
		PrintWriter out=new PrintWriter(System.out);
		int n=sc.nextInt();
		boolean ok=false;
		int a[][]=new int[n][2];
		for(int i=0;i<n;i++) {
			a[i][0]=sc.nextInt();
			a[i][1]=sc.nextInt();
			if(i>1&&a[i][0]==a[i][1]&&a[i-1][0]==a[i-1][1]&&a[i-2][0]==a[i-2][1]) {
				ok=true;
			}
		}

		System.out.println(ok?"Yes":"No");
	}

	static class FastScanner {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");

		String next() {
			while (!st.hasMoreTokens())
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		int[] readArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

}