import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[][] D;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[][] D;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} Main //フィールド
    Scanner sc; sc int N; N int[][] D; D public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) Main m = new Main(sc); m new Main(sc) m.show(m.solve()) m.show m m.solve() m.solve m sc.close() sc.close sc String[] args args //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    } Main {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    } this.sc = sc this.sc this this.sc sc this.N = sc.nextInt() this.N this this.N sc.nextInt() sc.nextInt sc this.D= new int[N][2] this.D this this.D new int[N][2] N 2 for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        } {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        } for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	} int j = 0; int j = 0; j 0 j < 2 j 2 j++ j++ j {
        		this.D[i][j] = sc.nextInt();
        	} {
        		this.D[i][j] = sc.nextInt();
        	} this.D[i][j] = sc.nextInt() this.D[i][j] this.D[i] this.D this this.D i j sc.nextInt() sc.nextInt sc Scanner sc sc //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    } solve {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    } String answer = "No"; answer "No" for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        } int i = 0; int i = 0; i 0 i < N-2 i N-2 N 2 i++ i++ i {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        } {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        } if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	} 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 {
        		answer = "Yes";
        		break;
        	} answer = "Yes" answer "Yes" break; return answer; answer //出力
    public void show(String answer) {
        System.out.println(answer);
    } show {
        System.out.println(answer);
    } System.out.println(answer) System.out.println System.out System System.out answer String answer answer public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[][] D;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[][] D;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int[][] D;
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        this.N = sc.nextInt();
        this.D= new int[N][2];
        for (int i = 0; i < N; i++) {
        	for (int j = 0; j < 2; j++) {
        		this.D[i][j] = sc.nextInt();
        	}
        }
    }
    
    //解答処理
    private String solve() {
        String answer = "No";
        
        for (int i = 0; i < N-2; i++) {
        	if (D[i][0] == D[i][1] && D[i+1][0] == D[i+1][1] && D[i+2][0] == D[i+2][1]) {
        		answer = "Yes";
        		break;
        	}
        }
        
        return answer;
    }
    
    //出力
    public void show(String answer) {
        System.out.println(answer);
    }

}
