peterverebics/CodeNet_Python_118 huggingface dataset:
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 all(elem == d[j][0] for elem in d[j]):
        cnt += 1
    else:
        cnt = 0
if ans:
    print ("Yes")
else:
    print("No")
N = int(input())

c = 0
L=[]
flag=False
for _ in range(N):
    d1, d2 = map(int, input().split())
    L.append(d1/d2)

for i in range(N-3):
    if sum(L[i:i+3]) == 3:
        flag=True
    
if flag:
    print('Yes')
else:
    print('No')
a=int(input())
b=[list(map(int,input().split())) for i in range(a)]

n=[]
for i in b:
    if i[0]==i[1]:
        n.append(1)
        continue
    n.append(0)
for i in range(a-3):
    if n[i]==1 and n[i+1]==1 and n[i+2]==1:
        print('Yes')
        exit()
print('No')
ctr = 0
for _ in range(int(input())):
    a, b = list(map(int, input().strip().split()))
    if a == b:
        ctr += 1
    else:
        ctr = 0
    
print(("No", "Yes")[ctr >= 3])
print('NYoe s'[[0]*3in[eval(t.replace(*' -'))for t in open(0)]::2])
n = int(input())

eq = 1
prev = False
for i in range(n):
    d = [int(s) for s in input().split(' ')]
    if d[0] == d[1]:
        if prev:
            eq += 1
        prev = True
    else:
        prev = False
        eq = 1

if eq >= 3:
    print('Yes')
else:
    print('No')
N = int(input())
count = 0
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
    elif D1 != D2:
        break
if (count >= 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 count==3:
            print("Yes")
            
        else:
            pass
            
    else :
        count=0

if count !=3:
    print('No')
N=int(input())
count=0
for i in range(N):
    a,b=map(int,input().split())

    if a==b:
        count+=1
        if count==3:
            print("Yes")
            exit()
        else:
            pass
    if a!=b:
        count==0

if count!=3:
    print('No')
N=int(input())

div = [0] * (N+1)
for d in range(1, N+1):
  for n in range(d, N, d):
      div[n] += 1

ans = sum(div[:N])
print(ans)
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
for i in range(N):
  if x[i]==y[i]:
    continue
  else:
    print("No")
    exit(0)
print("Yes")
n = int(input())
d = []
for i in range(n):
    d.append(list(map(int,input().split())))
row = []
for i in range(n):
    if d[i][0]==d[i][1]:
        row.append(True)
    else:
        row.append(False)
res = False
for i in range(n-3):
    if all(row[i:i+3]):
        res = True

if res:
    print('Yes')
else:
    print('No')
i = int(input())
count = 0
for i in range(i):
  a, b = input().split(' ')
  if a == b:
    count += 1
print('Yes' if count >= 3 else 'No')
n = int(input())
f = 0
for i in range(n):
	a,b = map(int, input().split())
	if(a == b):
		f = 1
if(f):
	print('Yes')
else:
	print('No')
n = int(input())
def judge():
    count = 0
    for _ in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            count += 1
        else:
            count = 0
        
        if count == 3:
            return True

    return False

if judge():
    print("yes")
else:
    print("no")
n = int(input())
l = []
for i in range(n):
    x,y = map(int,input().split())
    l.append((x,y))
for i in range(n-3):
    if l[i][0] == l[i][1] and l[i+1][0] == l[i+1][1] and l[i+2][0] == l[i+2][1]:
        print('Yes')
        exit()
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
    if d1 != d2:
        cnt = 0
print("No")
n = int(input())
a = [[int(i) for i in input().split()] for j in range(n)]
good = False
for i in range(n-3):
  ok = True
  for j in range(i, i+3):
    ok &= a[j][0] == a[j][1]
  good |= ok
print("Yes" if good else "No")
N=int(input())
D=[list(map(int,input().split())) for i in range(N)]
tf=0
for j in range(0,N-3):#Di1=Di2&Di+1_1=Di+1_2&Di1=Di2 3回連続ぞろ目
    if D[j][0]==D[j][1] and D[j+1][0]==D[j+1][1] and D[j+2][0]==D[j+2][1]:
        tf=1
        break

if tf==1:
    print("Yes")
else:
    print("No")
N = int(input())

d1=[]
d2=[]

cont=0
for i in range(N):
    D1,D2=map(int,input().split())

    d1.append(D1)
    d2.append(D2)

for i in range(len(d1)):
    if d1[i]==d2[i]:
        cont+=1
    else:
        cont=0
if cont>=3:
    print("Yes")
else:
    print("No")
N = int(input())
D = []
count = 0

for n in range(N):
    input_line = input().split()
    if (int(input_line[0]) == int(input_line[1])):
        count += 1
    else:
        pass

if count >= 3:
        print('Yes')

else:
        print('No')
N=int(input())
D={}
for i in range(N):
    D[i]=input().split()

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


if cou >= 3:
    print('Yes')
elif cou == 0:
    print('No')
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

    flag = False
    
    return flag

if judge() == True:
    print("yes")
else:
    print("no")
N = int(input())
count=0
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
for i in range(N):
  if x[i]==y[i]:
    count+=1
    continue
    
  else:
    print("No")
    exit(0)
if 3<=count:
  print("Yes")
else:
  print("No")
# coding:utf-8
n = int(input())
count = 0

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

    if d1 == d2:
        count += 1

    if count == 3:
        print('Yes')
        exit()
    else:
        count = 0

print('No')
n = int(input())
data = []
zoro = []
yn = False
for i in range(n):
    data = input().split()
    if data[0] == data[1]:
        zoro += [True]
    else:
        zoro += [False]
    if i > 1 and (zoro[i] == True or zoro[i-1] == True or zoro[i-2] == True):
        yn = True
print("Yes") if yn == True else print("No")
n = int(input())
zoro = 0

for i in range(n):
  d1, d2 = input().split()
  if d1 == d2:
    zoro += 1
  else:
    zoro = 0

if zoro >= 3:
  print('Yes')
else:
  print('No')
N = int(input())
D = []
for _ in range(N):
    d1, d2 = map(int, input().split())
    D.append(d1)
    D.append(d2)

flg = False
for i in range(N*2-2):
    if D[i] == D[i+1] == D[i+2]:
        flg = True
        break

if flg:
    print('Yes')
else:
    print('No')
N = int(input())
List = list()
for i in range(N):
  List.append(list(map(int, input().split())))
List = sum(List, [])
for i in range(1,N-2):
  if List[2*i-2] == List[2*i-1]:
    if List[2*i] == List[2*i+1]:
      if List[2*i+2] == List[2*i+3]:
        print("Yes")
        exit()
      else:
        pass
    else:
      pass
  else:
    pass
print("No")
N = int(input())

c = 0
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        c += 1

if c>=3:
    print('Yes')    
else:
    print('No')
import numpy as np
n = int(input())
x = [list(map(int,input().split())) for i in range(n)]

x=np.array(x).flatten()
count=0
tmp=0
for i in x:
    if count==2:
        print("Yes")
        break
        
    elif tmp==i:
        count+=1
    else:
        tmp=i
        count=0
else:
    print("No")
import numpy as np

n = int(input(""))
a = np.zeros((n,2))
cnt = 0

for i in range(n): 
    a[i] = input().split()

for i in range(n):
    if a[i][0] == a[i][1]:
        cnt +=1

if cnt >= 3:
    print("Yes")
else:
    print("No")
def main():
    N = int(input())
    zoro = 0
    for _ in range(N):
        d1 , d2 = map(int,input().split())
        if d1 == d2:
            zoro += 1
        else:
            zoro = 0
        if zoro > 2:
            print("yes")
            return
    print("No")

if __name__ == '__main__':
    main()
from sys import exit
N = int(input())

cnt = 0
for i in range(N):
    x,y = map(int,input().split())
    if cnt == 3:
        print("Yes")
        exit(0)
    if x == y:
        cnt += 1
    else:
        cnt = 0

print("No")
n=int(input())
l=[]
m=[]
for i in range(0,n):
  a,b=map(int,input().split())
  l.append(a)
  m.append(b)
c=0
i=0
while i<=n-3:
  if l[i]==m[i] and l[i+1]==m[i+1] and l[i+2]==m[i+2]:
      c=3
  i=i+2
if c==3:
  print('Yes')
else:
  print('No')
n = int(input())
count = 0
a = []

for i in range(n):
  al, be = map(int, input().split())
  if al == be:
    count += 1
    if count >= 3:
      print("Yes")
  else:
    count = 0
else:
  print("No")
n = int(input())
a,b = map(int,input().split())
c,d = map(int,input().split())
flag = 0
for i in range(n-2):
  e,f = map(int,input().split())
  if a == b and c == d and e == f:
    flag = 1
    break
  a,b = c,d
  c,d = e,f
if flag == 0:
  print("NO")
else:
  print("YES")
n = int(input())

cnt = 0
for i in range(n):
    d1, d2 = input().split()
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print('Yes')
        break
print('No')
s = ""
for _ in " "*int(input()):
  a,b = map(int,input().split())
  if a == b:
    s +="0"
if "000" in s:
    print("Yes")
else:
    print("No")
N = int(input())

counter = 0
for i in range(N):
    A, B = map(int, input().split())
    if A == B:
        counter += 1

if counter >= 3:
    print('Yes')
else:
    print('No')
N=int(input())

X=[]
Y=[]
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
A="NO"
for n in range(N-2):
    if X[n]==Y[n] and X[n+1]==Y[n+1] and X[n+2]==Y[n+2]:
        A="YES"
        break
print(A)
n = int(input())

zoro = 0

for i in range(n):
    d1, d2 = map(int, input().split())
    if zoro == 3:
        print("Yes")
        quit()
    elif d1 == d2:
        zoro = zoro + 1
    else:
        zoro = 0

print("No")
N = int(input())
count = 0
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
    elif count == 3:
        break
if count == 3:
    print('Yes')
else:
    print('No')
n=int(input())
c=1
count=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b:
        count+=1
    else:
        count=0
    if count==3:
        c=1
if c==1:
    print("Yes")
else:
    print("No")
N = int(input())
i = 0
for count in range(1, N+1):
    a, b = map(int, input().split())
    if a == b:
        i += 1
if i == 3:
    print('Yes')
else:
    print('No')
n = int(input())
x = 0
for i in range(n - 2):
    d1, d2 = map(int, input().split())
    if x != 3:
        if d1 != d2:
            x = 0
        else:
            x += 1
print("Yes" if x == 3 else "No")
import sys

n = int(input())
deme = [input().split() for i in range(n)]

#print(deme)

toki = 0

for i in range(n):
  if deme[i][0] == deme[i][1]:
    toki += 1
    if toki >= 3:
      print("YES")
      sys.exit(0)
    
  else:toki = 0

print("NO")
n = int(input())
p = [list(map(int,input().split())) for i in range(n)]
 
 
a = p[0]
b = 0
ans  = 0
tf = 1
 
for j in range(n):
  if sum(p[j]) // 2 ** 2 == sum(p[j]):
    ans += 1
  else:
    ans = 0
  if ans == 3:
    tf = 0
    print("Yes")
    break
    
if tf == 1:
  print("No")
import sys

n = int(input())
d1 = []
d2 = []
for i in range(n):
  t,u = map(int,input().split())
  d1.append(t)
  d2.append(u)
c = 0
for i in range(n):
  if d1[i] == d2[i]:
    c += 1
  else:
    c == 0
  if c == 3:
    print("Yes")
    sys.exit()
print("No")
# coding: utf-8
n = int(input())
L=[]
for i in range(n):
    a, b = map(int,input().split())
    if a==b:
        L.append(1)
    else:
        L.append(0)
flg=False
for i in range(n-3):
    if L[i] and L[i+1] and L[i+2]:
        flg=True
        break

if flg:
    print("Yes")
else:
    print("No")
N=int(input())
ans = 0
X = map(int,[input() for i in range(N)])

for i in range(N):
    if ans <= 3:
        print("Yes")
        break
    if i == ("1 1" or "2 2" or "3 3" or "4 4" or "5 5" or"6 6"):
            ans = ans + 1
    else:
        if ans == 1:
            ans = ans - 1
        if ans == 2:
            ans = ans - 2

else:
    print("No")
n=int(input())
a=[]
for i in range(n):
  a.append(list(map(int,input().split())))
ans="No"
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]:
        ans="Yes"
        break
print(ans)
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 13:06:46 2020

@author: Admin
"""

n=int(input())
l=[]
flag=0
for i in range(n):
    a,b=input().split()
    w=[int(a),int(b)]
    l.append(w)
for i in range(len(l)-2):
    if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
        print('yes')
        flag=1
        break
if flag==0:
    print('no')
n=int(input())
ans=0
x=0
for i in range(n):
    a,b=map(int,input().split())
    if a==b and i==x+1:
        ans+=1
        x=i
        if ans==3:
            x=0
            break
    elif a==b and i!=x+1:
        x=i
if ans==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())
count = 0
for _ in range(N):
    a,b = map(int, input().split())
    if a == b:
        count += 1
if count >= 3:
    print("Yes")
else:
    print("No")
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
a=0
for i in range(n):
  if x[i]==y[i]:
    a+=1
if a>=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 count>=3:
  print("Yes")
else:
  print("No")
n=int(input())
count=0
ren=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b and count<3:
    count+=1
    ren=1
  else:
    count=0
if count>=3:
  print("Yes")
else:
  print("No")
N = int(input())
t = 0
for i in range(N):
    a, b = [int(x) for x in input().split()]
    if a != b:
        t = 0
    else:
        t += 1
    if t == 2:
        break
if t == 3:
    print("Yes")
else:
    print("No")
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]

last = 0
for item in l:
  if last == 0 and l[0] == l[1]:
    last = 1
  if last == 1 and l[0] == l[1]:
    last == 2
  if last == 2 and l[0] == l[1]:
    last == 3
    break
  last == 0

if last == 3:
  print('Yes')
else:
  print('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")
    break
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
		else:
			f=0
			c=0
if(c >= 3):
  print("Yes")
else:
  print("No")
N = int(input())

count = 0
for i in range(N):
    x, y = map(int, input().split())
    if x == y:
        count += 1

if count < 3:
    print("No")
else:
    print("Yes")
N = int(input())

list = [input() for i in range(N)]

ans = "No"

for i in range(1, N):
  if i < N-1:
    a,b = map(int, list[i].split())
    x = int(list[i-1].split()[1])
    y = int(list[i+1].split()[0])
    if a == b == x:
      ans = "Yes"
    elif a==b==y:
      ans = "Yes"
  else:
    if a == b== x:
      ans = "Yes"

print(ans)
n = int(input())
a = []
found = False
count = 0
for i in range(n):
  al, b = map(int, input().split())
  a.append((a, b))
  if found:
    print("Yes")
    break
  if a[i][0] == a[i][1]:
    count += 1
    if count >= 3: # that means that the i is in last 3 numbers
      print("Yes")
      break
  else:
    count = 0
else:
  print("No")
n=int(input())
cnt=0
flag=True
for i in range(n):
    a,b=map(int,input().split())
    if a==b and flag==True:
      cnt+=1
    else:
        cnt=0
        flag=False
if cnt>=3:
  print("Yes")
else:
  print("No")
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 not count == 3:
        print ("No")
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]

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

if cnt >= 3:
    print("Yes")
else:
    print("No")
n = int(input())
d = [0] * n
x = [0] * n
for i in range(n):
    d[i], x[i] = map(int, input().split())
m = 0
for i in range(n-3):
  if d[i]==x[i] and d[i+1]==x[i+1] and d[i+2]==x[i+2]:
    break
  else:
    m = m+1
if m==n-3:
  print("No")
else:
  print("Yes")
N = int(input())

xy = [map(int,input().split()) for _ in range(N)]
x,y = [list(i) for i in zip(*xy)]

ans = 0

for i in range(N):
    if x[i] == y[i]:
        ans +=1
    else:
        ans -=1
        
if ans >= 3:
    print("Yes")
    
else:
    print("No")
n=int(input())
l1=[]
l2=[]
for i in range(n):
  x,y=(int(i) for i in input().split())
  l1.append(x)
  l2.append(y)
c=0
for i in range(n-2):
  if(l1[i]==l2[i] and l1[i+1]==l2[i+1] and l1[i+2]==l2[i+1]):
    c=1
    break
if(c==0):
  print("No")
else:
  print("Yes")
n = int(input())
count=0
flag=0
for num in range(n-1):
  i = list(map(int, input().split()))
  if i[0]==i[1]:
    count +=1
  else:
    count=0
  if count == 3:
    flag=1
if flag==0:
  print('No')
elif flag==1:
  print('Yes')
N=int(input())

X=[]
Y=[]
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)
    
A="NO"
for n in range(N-2):
    if X[n]==Y[n]:
        if X[n+1]==Y[n+1]:
            if X[n+2]==Y[n+2]:
                A="YES"
                break
            else:
                continue
        else:
            continue
    else:
        continue
print(A)
n = int(input())
d1d2 = [map(int, input().split()) for _ in range(n)]
d1, d2 = [list(i) for i in zip(*d1d2)]
h = 'No'
for i in range(n):
    if i > 2:
        if d1[i] == d2[i]:
            if d1[i-1] == d2[i-1]:
                if d1[i-2] == d2[i-2]:
                    h = 'Yes'
                    break
print(h)
N = int(input())
D = [input().split() for _ in range(N)]
zoro = [d1 == d2 for d1, d2 in D]
for i in range(N-3):
  if zoro[i] and zoro[i+1] and zoro[i+2]:
    print("Yes")
    exit()
print("No")
# coding:utf-8
n = int(input())
count = 0

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

    if d1 == d2:
        count += 1

    if count >= 3:
        print('Yes')
        exit()

print('No')
N = int(input())

d  = []
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        ans = "same"
    else:
        ans = "no"
    d.append(ans)
flag = "No"
for i in range(N-2):
    if d[i] == d[i+1] and d[i+1] == d[i+2]:
        flag = "Yes"
print(flag)
n = int(input())
count=0
flag=0
for num in range(n-1):
  i = list(map(int, input().split()))
  if i[0]==i[1]:
    count +=1
  else:
    count=0
  if count == 3:
    flag=1
    break
if flag==0:
  print('No')
elif flag==1:
  print('Yes')
cnt = 0
n = int(input())
for i in range(0,n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
        if cnt == 3 :
            print("Yes")
            break
    elif cnt != 3 and i == n-1:
        print("No")
    else:
        cnt == 0
N = int(input())

L=[]
flag=False
for _ in range(N):
    d1, d2 = map(int, input().split())
    L.append(d1/d2)

for i in range(N-2):
    if sum(L[i:i+3]) == 3:
        flag=True
    
if flag:
    print('Yes')
else:
    print('No')
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

count = 0

for i in range(N):
  if x[i] == y[i]:
    count += 1
    if count == 3:
      print("Yes")
    
  else:
    count = 0
    
  
print("No")
n=int(input())
ans=0
x=-1
for i in range(n):
    a,b=map(int,input().split())
    if a==b and i==x+1:
        ans+=1
        x=i
        if ans==3:
            x=0
            break
if ans==3:
    print('Yes')
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)

if y>2:
    print("Yes")
else:
    print("No")
i = int(input())
d = [list(map(int, input().split())) for i in range(i)]

c = 0
for i in range(len(d)):
    if (d[i][0] == d[i][1]):
        c += 1
print("Yes" if c <= 3 else "No")
N = int(input())
D = [list(map(int, input().split())) for i in range(N)]
cnt_cons=0

for i in range(1, N-2, 1):
  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]:
    print("Yes")
    cnt_cons += 1
    exit()
if cnt_cons == 0:
  print("No")
import sys
ls = []
N = int(input())
for l in sys.stdin:
    ls.append(l.split())

c = 0
p = 0
ans = 'No'
while len(ls) > (c+1):
    if ls[c][0] != ls[c][1]:
        c += 1
        p = 0
        continue
    else:
        c += 1
        p += 1
        if p == 3:
            ans = 'Yes'
            break

print(ans)
def run(n, _in_list):
    '''
    '''
    is_doublet_count = 0
    for x in _in_list:
        _in = list(x)
        if _in[0] ==_in[1]:
            is_doublet_count += 1
        else:
            is_doublet_count = 0
    
    print('Yes' if is_doublet_count >= 3 else 'No')
    




if __name__ == '__main__':
    n = int(input())
    _in_list = [map(int, input().split()) for _ in range(n)]
    run(n, _in_list)
import sys

N=int(input())
cnt=0
 
for i in range(N):
  D_1,D_2=map(int,input().split())
  if cnt==3:
    print('Yes')
    sys.exit()
  if D_1==D_2:
    cnt+=1
  else:
    cnt=0

print('No')
n = int(input())

ans = 'No'
count = 0
for i in range(n):
  a,b = map(int,input().split())
  if a==b:
    count += 1
    if count == 3:
      ans = 'Yes'

print(ans)
import numpy as np

n = int(input(""))
a = np.zeros((n,2))
cnt = 0

for i in range(n): 
    a[i] = input().split()
    if a[i,0] == a[i,1]:
        a[i] = [0]

for i in range(n-1):
    if a[i,0] == a[i+1,0]:
        cnt += 1
    elif cnt >= 2:
        cnt = cnt
    else:
        cnt = 0


if cnt >= 2:
    print("Yes")
else:
    print("No")
N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
A="NO"
for n in range(N-2):
    if x[n][0]==x[n][1] and x[n+1][0]==x[n+1][1] and x[n+2][0]==x[n+2][1]:
        A="YES"
        break
print(A)
n = int(input())
cnt = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    cnt += 1
  else:
    cnt = 0
if cnt >= 3:
  print('Yes')
else:
  print('No')
n = int(input())
d = []
for i in range(n):
    d.append(list(map(int,input().split())))
row = []
for i in range(n):
    if d[i][0]==d[i][1]:
        row.append(True)
    else:
        row.append(False)
res = False
for i in range(n-2):
    print(row[i:i+3])
    if all(row[i:i+3]):
        res = True
if res:
    print('Yes')
else:
    print('No')
#!/usr/bin/env python

n = int(input())
d = [[0 for _ in range(2)] for _ in range(n)]
for i in range(n):
    d[i][0], d[i][1] = map(int, input().split())

for i in range(n-3):
    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]:
        print('Yes')
        exit()
print('No')
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]

last = 0
for item in l:
  if last == 0 and item[0] == item[1]:
    last = 1
    continue
  elif last == 1 and item[0] == item[1]:
    last = 2
    continue
  elif last == 2 and item[0] == item[1]:
    last = 3
    break
  last == 0

if last == 3:
  print('Yes')
else:
  print('No')
i = int(input())
count = 0
for i in range(i):
  a, b = input().split(' ')
  if a == b:
    count += 1
  else:
    count = 0
print('Yes' if count >= 3 else '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")