import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	}
}









 import java.util.ArrayDeque; ArrayDeque java.util import java.util.ArrayList; ArrayList java.util import java.util.Deque; Deque java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util import java.util.stream.Collectors; Collectors java.util.stream public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Deque<List<Integer>> D = new ArrayDeque<>(); D new ArrayDeque<>() List<Integer> tmp = new ArrayList<Integer>(); tmp new ArrayList<Integer>() int N=sc.nextInt(); N sc.nextInt() sc.nextInt sc for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		} int i=0; int i=0; i 0 i<N i N i++ i++ i {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		} {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		} int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc tmp.add(a) tmp.add tmp a tmp.add(b) tmp.add tmp b D.add(tmp.stream().collect(Collectors.toList())) D.add D tmp.stream().collect(Collectors.toList()) tmp.stream().collect tmp.stream() tmp.stream tmp Collectors.toList() Collectors.toList Collectors tmp.clear() tmp.clear tmp tmp=null tmp null int cnt=0; cnt 0 while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		} D.size()!=0 && cnt<3 D.size()!=0 D.size() D.size D 0 cnt<3 cnt 3 {
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		} List<Integer> d =D.poll(); d D.poll() D.poll D if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			} d.get(0)==d.get(1) d.get(0) d.get d 0 d.get(1) d.get d 1 {
				cnt+=1;
			} cnt+=1 cnt 1 {
				cnt=0;
			} cnt=0 cnt 0 if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		} cnt>=3 cnt 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" sc.close() sc.close sc String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	}
} Main
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Deque<List<Integer>> D = new ArrayDeque<>();
		List<Integer> tmp = new ArrayList<Integer>();

		int N=sc.nextInt();
		for(int i=0;i<N;i++) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			tmp.add(a);
			tmp.add(b);
			D.add(tmp.stream().collect(Collectors.toList()));
			tmp.clear();
		}
		tmp=null;

		int cnt=0;
		while(D.size()!=0 && cnt<3){
			List<Integer> d =D.poll();
			if(d.get(0)==d.get(1)) {
				cnt+=1;
			}
			else {
				cnt=0;
			}
		}
		if(cnt>=3) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		sc.close();
	}
}










