peterverebics/CodeNet_Python_118 huggingface dataset:
N=int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
cnt=0
result="No"
# 出力して確認
#for n in range(N-1):
for i in range(N):
    cnt+=1 if x[i]==y[i] else 0
    if cnt>2:
        result="Yes"
print(result)
from collections import defaultdict 
import sys
import math 
import random
def get_array(): return list(map(int , sys.stdin.readline().strip().split()))
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def input(): return sys.stdin.readline().strip()

cnt = 0
n = int(input())
for i in range(n):
    (x,y) = get_ints()
    if x==y:
        cnt+=1
if cnt>=3:
    print("Yes")
else:
    print("No")
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(i)

for i in range(len(z)-3):
  if z[i]==z[i+1]-1:
    if z[i+1]==z[i+2]-1:
      y += 1
if y > 0:
  print("Yes")
else:
  print("No")
import sys

n = int(input())

zoro = 0
res = 0

for i in range(n):
    d1, d2 = map(int, input().split())

    if zoro == 3:
        res = 1
    if d1 != d2:
        zoro = 0
    else:
        zoro = zoro + 1
        
if res == 1:
    print("Yes")
else:
    print("No")
c = int(input())
count = 0

d = [list(map(int,input().split())) for i in range(c)]
for i in range(c):
    a,b = d[i][0],d[i][1]
    
    if (a==b):
        count += 1
    else : 
        count = 0

if (count >= 3):
        
    print("Yes")
else :
    print("No")
N = int(input())
result = '0'
for i in range(N):
  d1,d2 = map(int, input().split())
  if d1 == d2:
    result += '1'
  else:
    result += '0'
if '111' in result:
  print('Yes')
n=int(input())
ans=0
for i in range(n):
	a,b=map(int,input().split())
	if a==b:
		ans+=1
	else:
		ans=0
if ans>=3:
	print('Yes')
else:
	print('No')
n=int(input())
lst1=[]
lst2=[]
count=0
for _ in range(n):
    m,k=[int(x) for x in input().split()]
    lst1.append(m)
    lst2.append(k)
if(n<3):
    print('NO')
else:
    
    for i in range(n-2):
        if(lst1[i]==lst2[i] and lst1[i+1]==lst2[i+1] and lst1[i+2]==lst2[i+2]):
            count=3
            break
    if(count>=3):
        print('YES')
    else:
        print('NO')
n = int(input())
A = [[int(i) for i in input().split()] for j in range(n)]
for i in range(n-3):
    if A[i][0] == A[i][1] and A[i+1][0] == A[i+1][1] and A[i+2][0] == A[i+2][1]:
        print("Yes")
        break
else:
    print("No")
import random

x = input()
x = int(x)

result = []  # 結果を入れるリストを用意

for n in range(x):
     z=[random.randint(1, 6),random.randint(1, 6)]
     if z[0]==z[1]:
        r=1
     else:
        r=0    
     result.append(r)

y=sum(result)
print(result)
maped_list = map(str, result)
txt = ''.join(maped_list)

ans3=txt.count('111')
print(txt)

if ans3>1:
    print("yes")
else:
    print("no")
N = int(input())
K = 0
for i in range(N):
    x,y = map(int,input().split())
    if x == y:
        K += 1
if K >= 3:
    print("Yes")
else:
    print("No")
N = int(input())
j = 0
for i in range(0, N):
    D = str(input())
    D = D[0::2]
    if D[0] == D[1]:
        j += 1

if j == 3:
    print("Yes")
elif j == 6:
    print("Yes")
elif j != 3:
    print("No")
else:
    print("No")
n = int(input())
d = [input().split(" ") for _ in range(n)]

f = False
for i in range(n-2):
    if d[i][0] == d[i][1] or not f :
        if d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
            f = True
if f:
    print("Yes")
else:
    print("No")
times = int(input())
zorome = 1
for i in range(times):
  a = input().rstrip().split(" ")
  b = int(a[0])
  c = int(a[1])
  if b == c:
    zorome = zorome + 1
  else:
    zorome = 0
if zorome > 3:
  print("Yes")
else:
  print("No")
n = int(input())

count=0

for i in range(n):
    a,b = map(int, input().split())
    if a==b:
        count+=1
    if a!=b:
        if count<3:
            count=0
if count>2:
    print('YES')
elif count<3:
    print('NO')
n = int(input())
l = [list(map(int, input().split())) for i in range(n)]
#print(l[0][0])
#print(l[0][1])
ans = n-2
ans1 = 0

for m in range(ans):
  if l[m][0]  == l[m][1] and l[m+1][0] == l[m+1][1] and l[m+2][0] == l[m+2][1]:
    ans1 += 1
  else:
    ans1 = 0
    
    
if ans1 >= 1:
  print("Yes")
else:
  print("No")
N = int(input())
D = [list(map(int,input().split())) for _ in range(N)]

cnt,cnt_max = 0,0
for i in range(N):
    if D[i][0] == D[i][1]:
        cnt += 1
    else:
        cnt_max = cnt
        cnt = 0

cnt_max = max(cnt_max,cnt)

if cnt_max >= 3:
    print("Yes")
else:
    print("No")
N, *D = map(int, open(0).read().split())

D = [(d1, d2) for d1, d2 in zip(*[iter(D)] * 2)]

for i in range(N - 3):
    if all(D[i + j][0] == D[i + j][1] for j in range(3)):
        print("Yes")
        break
else:
    print("No")
def main():
	N = int(input())
	cnt = 0
	maxcnt = 0
	for n in range(N):
		D = list(map(int,input().split()))
		if D[0] == D[1]:
			cnt += 1
		else:
			maxcnt = cnt
			cnt = 0
	if maxcnt >= 3 or cnt >= 3:
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
    main()
N = int(input())

flag = 0

for i in range(N):
    a,b = map(int,input().split())
    if a == b:
        flag += 1

if flag >= 3:
    print("Yes")
else:
    print("No")
#179-B

N = int(input())
A = []

for i in range(N):
    D,H = map(int,input().split())

    if D == H:
        A.append(i)

#print(A)

if len(A) <= 2:
    print("No")

else:
    for j in range(len(A)-2):
        if A[j]+1 == A[j+1] and A[j+1]+1 == A[j+2]:
            print("Yes")
            break
def main():
    n = int(input())

    count = 0
    answer = 'No'
    for i in range(n):
        d = list(map(int, input().split()))
        if d[0] == d[1]:
            count += 1
        if count >= 3:
            answer = 'Yes'
            break

    print(answer)


if __name__ == '__main__':
    main()
x=int(input())
l=[]
c=0
for i in range(x):
    a,b = map(int,input().split())
    l.append(a)
    l.append(b)
for i in range(0,x*2,2):
    if l[i]==l[i+1]:
        c+=1
        if c>=3:
            print("YES")
            break

    else:
        c=0
if c<3:
    print("NO")
n=int(input())
ans=0
c=True
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        ans+=1
    if ans==3:
        print("Yes")
        c=False
        break
if c==True:
    print("No")
n = int(input())
cnt = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if cnt == 3:
        print("Yes")
        exit()
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
print("No")
N=int(input())
L=0
for i in range(N):
    K=set(map(int,input().split()))
    if len(K)==1:
        L+=1
    else:
        L=0
if L>=3:
    print('Yes')
else:
    print('No')
n=int(input())
ans=0
D=[]
for i in range(n):
  a,b=map(int, input().split())
  D.append(a)
  D.append(b)


for i in range(len(D)-1):
  if D[i]==D[i+1]:
    ans +=1

if ans>=3:
  print("Yes")
  
else:
  print("No")
count = 0
for i in range(int(input())):
    l = list(map(int, input().split()))
    if l[0] == l[1]:
        count += 1
    elif l[0] != l[1]:
        count = 0
if count >= 3:
    print("Yes")
else:
    print("No")
temp = list()
for _ in range(int(input())):
    temp.append(tuple(map(int, input().split())))
i = 0
con = 0
bool = True
while i < len(temp):
    if con == 3:
        bool = False
        print('Yes')
        break
    elif temp[i][0] == temp[i][1]:
        con += 1
        i += 1
    else:
        con = 0
        i += 1
if bool:
    print('No')
n = int(input())
dlist = [list(map(int,input().split())) for _ in range(n)]

cnt = 0
renzoku = 0
for d in dlist:
    if d[0] == d[1]:
        cnt+=1
        renzoku += 1
    else:
        renzoku = 0
    if cnt == 3 and renzoku == 3:
        print('Yes')
        break
else:
    print('No')
N = int(input())

for _ in range(N):
  D = map(int, input().split())
  D = list(D)
  if D[0] == D[1]:
    print('Yes')
    break
else:
  print('No')
n=int(input())
ans=0
D=[]
for i in range(n):
  a,b=map(int, input().split())
  D.append(a)
  D.append(b)


for i in range(len(D)-2):
  if D[i]==D[i+1] and D[i+1]==D[i+2]:
    ans +=1

if ans>0:
  print("Yes")
  
else:
  print("No")
import itertools

N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]

D_1 = list(itertools.chain.from_iterable(D))
flag = False
for i in range(len(D_1)-2):
    if D_1[i] == D_1[i+1] == D_1[i+2]:
        flag = True


if flag:
    print('Yes')
else:
    print('No')
n = int(input())
a = []
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        a.append(True)
    else:
        a.append(False)
a.append(False)
a.append(False)
for i in a:
    if i == True:
        if a[a.index(i)+1] and a[a.index(i)+2]:
            print("Yes")
            exit()
print("No")
n = int(input())
count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        if count > 0:
            count -= 1
        else:
            pass
print('Yes' if count >= 3 else 'No')
n = int(input())
x = [list(map(int,input().split())) for i in range(n)]

count=0
for i in x:
    if count==3:
        print("Yes")
        break
        
    elif i[0]==i[1]:
        count+=1
    else:
        count=0
else:
    print("No")
n = int(input())
flag= True
count = 0
for i in range(n):
  a,b = list(map(int, input().split()))
  if a==b:
    count += 1
  else:
    count= 0
  if count==3:
    flag = True
if flag:
  print("yes")
else:
  print("no")
n = int(input())
d1d2 = [map(int, input().split()) for _ in range(n)]
d1, d2 = [list(i) for i in zip(*d1d2)]
count = 0
for i in range(n-3):
    if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
        count += 1
if count > 0:
    print("Yes")
else:
    print("No")
t = int(input())
con = []
for i in range(t):
    a, b = map(int, input().split())
    if a==b:
        con.append(1)
    else:
        con.append(0)
    ans =0
for i in con:
    if i ==1:
        ans += 1
    else:
        ans = 0
if ans >= 3:
    print("Yes")
else:
    print("No")
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]
for i in range(N-3):
    if D[i][0] == D[i][1]:
        if D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
            print('Yes')
            exit()
print('No')
s = int(input())
d = [[int(v) for v in input().split()] for i in range(s)]
ans = False
cnt = 0
for j in range(len(d)):
    if cnt == 3:
        ans = True
        break
    if d[j].count(d[j][0]) == len(d[j]):
        cnt += 1
    else:
        cnt = 0
if ans:
    print ("Yes")
else:
    print("No")
n = int(input())
ary = [map(int, input().split()) for _ in range(n)]
pair1, pair2 = [list(i) for i in zip(*ary)]
ans = []
count = 0
for j in range(n):
    if(pair1[j] == pair2[j]):
        ans.append(1)
    else: ans.append(0)
#     [0,1,1,1,0]
for idx in ans:
    if(ans[idx] == 1):
        count += 1
        if(count == 3):
            print('Yes')
            break
        else: continue
    else:
        count = 0
        continue

if(count != 3):
    print('No')
N = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
l=list(map(lambda x,y:x-y,x,y))
ans=0
for i in range(N-2):
    if sum(l[i:i+3])==0:
        ans=1
        break
if ans==1:
    print("Yes")
else:
    print("No")
N = int(input())
D = []

ans =0
for _ in range(N):
    N,M=(map(int, input().split()))
    if N==M:
        ans +=1

if ans == N:
    print("Yes")
else:
    print("No")
n=int(input())
ans=0
c=True
d=[]
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        d.append(i)
if len(d)<3:
    print("No")
else:
    for i in range(1,len(d)):
        if d[i]-d[i-1]==1:
            ans+=1
    if ans>=2:
        print("Yes")
    else:
        print("No")
N = int(input())

lst=[]
for i in range(N):
    lst.append(list(map(int,input().split())))

cnt = 0
for a, b in lst:
  if a == b:
    cnt += 1
  else:
    continue

if cnt >= 3:
  print('Yes')
else:
  print('No')
n=int(input())
c=[]
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c.append(1)
  else:
    c.append(0)
for j in range(2,n):
  if c[j-2]==c[j-1] and c[j-1]==c[j]:
      print("Yes")
      exit()
print("No")
import random

x = input()
x = int(x)

result = []  # 結果を入れるリストを用意

for n in range(x):
    z=[random.randint(1, 6),random.randint(1, 6)]
    if z[0]==z[1]:
        r=1
    else:
        r=0    
    result.append(r)

y=sum(result)
maped_list = map(str, result)
txt = ''.join(maped_list)

ans3=txt.count('111')

if ans3>1:
    print("Yes")
else:
    print("No")
n = int(input())
flg = False

res = []
for i in range(n):
    d1, d2 = map(int, input().split())
    res.append(int(d1 == d2))

for i in range(n-3):
    if (res[i] + res[i+1] + res[i+2]) == 3:
        flg = True
        break
if flg:
    print('Yes')
else:
    print('No')
n=int(input())

a = 0
for i in range(n):
    li = input().split()
    if(li[0]==li[1]):
        print(li[0])
        a+=1
    elif(a<3):
        a=0
    else:
        print("Yes")
        exit()
if(a>2):
    print("Yes")
    exit()

print("No")
loop = int(input())
streak = 0
for i in range(loop):
    diceArr = input().split()
    if streak==3:
        print('Yes')
        break
    else:
        if diceArr[0] == diceArr[1]:
            streak+=1
        else:
            streak=0
if streak != 3:
    print('No')
N=int(input())
z=0
ans=0
for i in range(N):
    a,b=map(int,input().split())
    if a==b:z+=1
    else:ans=max(ans,z);z=0
print('Yes'if 2<ans else'No')
n = int(input())
flag = 0
for i in range(n):
    a, b = map(int,input().split())
    if flag >= 3:
        print("Yes")
        exit()
    if a == b:
        flag += 1
    else:
        flag *= 0
print("No")
N = int(input())
D = []
for _ in range(N):
    D.extend(input().split())

prev_val = ''
count = 0
for i in D:
    if prev_val == i:
        count += 1
        if count == 2:
            break
    else:
        prev_val = i
        count = 0

if count >= 2:
    print('Yes')
else:
    print('No')
n = int(input())
d1 = [0]*n
d2 = [0]*n
h = 'No'
for i in range(n):
    d1[i], d2[i] = map(int, input().split())
    if i > 2:
        if d1[i] == d2[i]:
            if d1[i-1] == d2[i-1]:
                if d1[i-2] == d2[i-2]:
                    h = 'Yes'
print(h)
n=int(input())
c=[]
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c.append(1)
  else:
    c.append(0)
cnt=0
for j in range(2,n):
  if c[j-2]==c[j-1] and c[j-1]==c[j]:
      print("Yes")
      break
  if j==n-1:
      print("No")
s=0
for i in range(int(input())):
  a,b=input().split()
  if a==b:s+=1
  else:s=0
if s==3:print('Yes')
else:print('No')
N = int(input())

D = []
for i in range(N):
    D.append(list(map(int,input().split())))

for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = "Yes"
    else:
        ans = "No"
print(ans)
N=int(input())
count=0
lst=[]
for i in range(N):
    x,y=map(int,input().split())
    # l=[]
    # l.append(x)
    # l.append(y)
    # lst.append(l)
    if x==y:
        count+=1
    if x!=y:
        break
if count==3:
    print("Yes")
else:
    print("No")
s=int(input())
d = [list(map(int,input().split())) for _ in range(s)]

def p(val):
    print(val)

def calc(s,d):
    for i in range(s-2):
        if d[i][0] == d[i][1] and d[i+1][0]==d[i+1][1] and d[i+2][0] == d[i+1][1]:
            
            return 'Yes'
    
    return 'No'

        
p(calc(s,d))
N = int(input())

count = 0

for i in range(N):
    k, t = map(int, input().split())
    if count == 3:
      print ( "Yes" )
     
      break
      
    if not k == t:
        count *= 0
    if k == t:
       count += 1 
if count <= 3:
        print ("Yes")
else:
  print ("No")
n=int(input())
l=[list(map(int,input().split())) for _ in range(n)]
f=[]
for x in l:
	f.append(x[0]==x[1])
l=f.copy()
i=0
while i<n:
	j=0
	while i+j<n and l[i+j]==l[i]:
		j+=1 
	if j>2:
		print('Yes')
		break	
	i+=j
else:
	print('No')
N = int(input())

row = 0
ans = 'No'

for n in range(N):
    D1, D2 = map(int, input().split())
    if D1==D2 and row<3:
        row+=1
    elif row==3:
        ans='Yes'
    else:
        row=0
print(ans)
N = int(input())

count = 0

for i in range(N):
    k, t = map(int, input().split())
    if count == 3:
      print ( "yes" )
      count += 5
      break
      
    if not k == t:
        count *= 0
    if k == t:
       count += 1 
       
      
if not count >= 3:
  print ("no")
N = int(input())
prev = [False, False, False]
for n in range(N):
    if all(prev):
        print('Yes')
        import sys
        sys.exit()
    D1, D2 = list(map(int, input().split(' ')))
    prev = prev[1:] + [D1 == D2]

print('No')
n = int(input())
ans = "No"
count = 0
for i in range(n):
    D1,D2 = map(int,input().split())
    count+=1 if D1==D2 else 0
    ans="Yes"  if D1 >= 3 else ans

print(ans)
n = int(input())
c = 0
for _ in range(n):
    r = [int(e) for e in input().split(" ")]
    if(c == 3):
        print("Yes")
        break
    elif(r[0] == r[1]):
        c += 1
    else:
        c = 0
else:
    print("No")
N = int(input())
sub_yes = 0
max_yes = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        sub_yes += 1
    else:
        max_yes = sub_yes
        sub_yes = 0

if sub_yes > max_yes:
    max_yes = sub_yes
# print(max_yes)
# print(sub_yes)
if max_yes >= 3:
    print("yes")
else:
    print("no")
N = int(input())
cnt = 0
flg = False
for _ in range(N):
    a, b = map(int, input().split())
    if a != b:
        cnt = 0
    else:
        cnt += 1
        flg = True

if flg:
    print('Yes')
else:
    print('No')
n=int(input("enter n"))
for i in range(0,n):
  count=0
  m,n=input("Enter a three value: ").split() 
  if(m==0):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")
def divisor(n): 
    i = 1
    count = 0
    while i * i < n:
        if n%i == 0:
           count += 2
        i += 1
    if i * i == n:
    	count =+ 1
    return count
    
n = int(input())

count = 0
for num in range(n):
	count += divisor(num)
print(count)
num = int(input())
ans = 0
cnt = 0
for x in range(num):
    d1, d2 = map(int, input().split())
    if d1 == d2: cnt += 1
    else: 
        ans = max(cnt, 2)
        cnt = 0
ans = max(cnt, 2)
if ans >= 3: print("Yes")
else:  print("No")
import numpy as np
N=int(input())
div = np.zeros(N+1, np.int64)
for n in range(1, N+1):
    for m in range(n, N+1, n):
        div[m] += 1
print(sum(div))
n = int(input())
count = 0
for i in range(n):
    a,b = map(int,input().split())
    if a==b:
        count += 1

print('Yes' if count > 2 else 'No')
n = int(input())
l1 = []
l2 = []
for l in range(n):
  a,b = map(int,input().split())
  l1.append(a)
  l2.append(b)
for i in range(n-3):
  if l1[i] == l2[i] and l1[i+1] == l2[i+1] and l1[i+2] == l2[i+2]:
    print("Yes")
    break
else:
  print("No")
n = int(input())
num_list = []
for i in range(n):
    a,b = map(int,input().split())
    num_list.append((a,b))
    
counter = 0 
d = 0
for x,y in num_list:
    if counter == 3:
        d += 1
        break
    if x == y:
        counter += 1
    else:
        counter = 0

if d == 1:
    print("Yes")
else:
    print("No")
import os,sys
c=0

n=input()
for i in range(int(n)):
    m=input()
    one=m[0]
    two=m[2]
    if(one==two):
        c+=1
    else:
        c=0
    
if(c>=3):
    print('Yes')
else:
    print('No')
N = int(input().strip())

a = []
c =0
f = 0
for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)
#print(a[4][1])
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f=i
			c+=1
if(c >= 3):
  print("Yes")
else:
  print("No")
N = int(input())
z,w = [],[]
K = 0
for i in range(N):
  x,y = map(int,input().split())
  z.append(x)
  w.append(y)
for j in range(1,N-2):
  if z[j] == w[j] and z[j+1] == w[j+1] and z[j+2] == w[j+2]:
    K += 1

if K >= 1:
  print("Yes")
else:
  print("No")
n = int(input())
D = [list(map(int, input().split())) for _ in range(n)] 
ct = 0
CT = []
for i in range(n):
    if D[i][0] == D[i][1]:
        ct += 1
    else:
        CT.append(ct)
        ct = 0
for k in CT:
    if k >= 3:
        print('Yes')
        exit()
print("No")
N = int(input())
count = 0
temp = 0

for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        if temp < count:
            temp = count

        count = 0

if temp >= 3:
    print('Yes')
else:
    print('No')
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
          


n = 0
for i in range(N-1):
    if x[i] == y[i]:
        n = n+1
    elif n >=3:
        break
    elif x[i] != y[i]:
        n = 0

if n >= 3:
    print("Yes")
else:
    print("No")
N = int(input())
ct = 0
for i in range(N):
    s,g = map(int,input().split())
    if s == g:
        ct += 1
    else:
        ct = 0
    if ct == 3:
        print("yes")
        break
else:
    print("No")
print('NYoe s'[[*'000']in[eval(t.replace(*' -'))for t in open(0)]::2])
n = int(input())

def judge():
    count = 0
    flag = True
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        
        if count == 3:
            flag = True
            break
        else:
            flag = False
    return flag

if judge() == True:
    print("yes")
else:
    print("no")
N = int(input())
count = 0
for i in range(N):
  D1,D2 = map(int,input().split())
  if count == 3:
    print('Yes')
    exit()
  elif D1 == D2:
    count += 1
  else:
    count = 0

print('No')
N = int(input())
D = []
for i in range(N):
    a = list(map(int,input().split()))
    D.append(a[0])
    D.append(a[1])
tf = 0
for i in range(2*N - 2):
    if D[i] == D[i+1] == D[i+2]:
        tf = 1
if tf == 1:
    print("Yes")
else:
    print("No")
t = int(input())
ans = 0
con = 0
for i in range(t):
    a, b = map(int, input().split())
    if a==b:
        ans += 1
        con += 1
        if con >= 3:
            a = "Yes"
            break
        else:
            a = "No"
    else:
        con = 0
print(a)
import os,sys
c=0

n=input()
for i in range(int(n)):
    m=input()
    one=m[0]
    two=m[2]
    if(one==two):
        c+=1
    
if(c>=3):
    print('Yes')
else:
    print('No')
iterate = int(input())
cnt = 0
for i in range(iterate):
  dice = list(map(lambda x: int(x), input().split()))
  if dice[0]==dice[1]:
    cnt += 1
  if dice[0]!=dice[1]: cnt=0
  if cnt==3: break
    
if cnt!=0: print("Yes")
else: print("No")
N =int(input())
D = []
for i in range(N):
  d_1,d_2 = map(int,input().split())
  D.append([d_1,d_2])
for x in range(N-2):
  if D[x][0]==D[x][1] and D[x+1][1]==D[x+1][0] and D[x+2][1]==D[x+2][0]:
    print("Yes")
    break
  else:
    print("No")
N = int(input())

cnt = 0
judge = False

for _ in range(N):
    if cnt == 3:
        judge = True

    D1, D2 = map(int, input().split())
    if D1 == D2:
        cnt += 1
    else:
        cnt = 0


if judge:
    print('Yes')
else:
    print('No')
N=int(input())
count=0
lst=[]
for i in range(N):
    x,y=map(int,input().split())
    # l=[]
    # l.append(x)
    # l.append(y)
    # lst.append(l)
    if x==y:
        count+=1
    if x!=y:
        continue
        count=0
if count==3:
    print("Yes")
else:
    print("No")
n = int(input())
str_list = [list(input().split()) for _ in range(n)]
for i in range(n-2):
  if str_list[i][0] == str_list[i][1] and str_list[i+1][0] == str_list[i+1][1] and str_list[i+2][0] == str_list[i+2][1]:
  	break
  print('Yes')
else:
  print('No')
N = int(input())
S = []
judge = 0
for i in range(N):
    S += [input().split()]
for i in range(N):
    if i < N-i:
        if S[i][0] == S[i][1]:
            if S[i+1][0] == S[i+1][1]:
                if S[i+2][0] == S[i+2][1]:
                    print("Yes")
                    judge = 1
                    break
if judge == 0:
    print("No")
data=[]
for _ in range(int(input())):
    d1,d2=input().split()
    d1=int(d1)
    d2=int(d2)
    if d1==d2:
        data.append(1)
longest = 0
current = 0
for num in data:
    if num == 1:
        current += 1
    else:
        longest = max(longest, current)
        current = 0
        
if max(longest, current)>=3:
    print('Yes')
else:
    print('No')