AtCoder Beginner Contest 179
B
Go to Jail
AtCoder
⌀ 0
原题
← AC →
翻译中…

Problem Statement

翻译中…

Tak performed the following action $N$ times: rolling two dice. The result of the $i$-th roll is $D_{i,1}$ and $D_{i,2}$.

翻译中…

Check if doublets occurred at least three times in a row. Specifically, check if there exists at lease one $i$ such that $D_{i,1}=D_{i,2}$, $D_{i+1,1}=D_{i+1,2}$ and $D_{i+2,1}=D_{i+2,2}$ hold.

翻译中…

Constraints

翻译中…
  • $3 \leq N \leq 100$
  • $1\leq D_{i,j} \leq 6$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
D_{1,1} D_{1,2}
\vdots
D_{N,1} D_{N,2}

翻译中…

Output

翻译中…

Print Yes if doublets occurred at least three times in a row. Print No otherwise.

翻译中…

样例

Input #1
5
1 2
6 6
4 4
3 3
3 2
Output #1
Yes
From the second roll to the fourth roll, three doublets occurred in a row.
Input #2
5
1 1
2 2
3 4
5 5
6 6
Output #2
No
Input #3
6
1 1
2 2
3 3
4 4
5 5
6 6
Output #3
Yes
题目信息
题号
abc179_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。