Problem:


Score : 200 points

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.

Sample Input 1

5
1 2
6 6
4 4
3 3
3 2

Sample Output 1

Yes

From the second roll to the fourth roll, three doublets occurred in a row.

Sample Input 2

5
1 1
2 2
3 4
5 5
6 6

Sample Output 2

No

Sample Input 3

6
1 1
2 2
3 3
4 4
5 5
6 6

Sample Output 3

Yes



Sample input:
5
1 2
6 6
4 4
3 3
3 2


Sample output:
Yes

Submission status: Runtime Error

Solution code:
N = int(input())
j = 0
if N >= 3:
    D = [input().split() for _ in range(N)]
	for i in D:
        if i[0] == i[1]:
            j += 1
    if j == 3:
        print("Yes")
    elif j == 6:
        print("Yes")
    elif j != 3:
        print("No")
    else:
        print("No")

Submission status: Runtime Error

Solution code:
num = int(input())

count = 0
flag = False
for i in range(num):
    a,b = read().split()
    if a == b:
        count += 1
        if count >= 3:
            print("Yes")
            flag = True
            break
    else:
        count = 0
if flag:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]
    
for i in range(len(l)):
  if l[i][0]==l[i][1]:
    if l[i+1][0]==l[i+1][1]:
      if l[i+2][0]==l[i+2][1]:
        print('Yes')
      else:
        print('No')
    else:
      print('No')
        
  else:
    print('No')

Submission status: Runtime Error

Solution code:
num = int(input())

count = 0
for i in range(num):
    a,b = read().split()
    if a == b:
        count += 1
        if count >= 3:
            print(Yes)
            return()
    else:
        count = 0
print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
eq_count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        exit(0)
print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
arr= []
for i in range(n):
  z = [ int(i) for i in input().split()]
  arr.append(z)
  
count = 0
x=[]
for i in range(n):
  if arr[i][0] == arr[i][1]:
      count+=1
      x.append(i)
cu = 0
for i  in range(n):
    if n-i>3:
        if x[i]+1 == x[i+1] and x[i+1]+1 == x[i+2] and x[i+2]+1 == x[i+3]:
            cu +=1
            break
         
         
    
      
if count>=3 and cu >=1:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
for _ in range(n):
    d1, d2 = map(int, input().split(" "))
    if d1 == d2:
        count += 1
    else:
        count = 0
    
    
    if count >= 3:
        print("yes")
        break
if count < 3:
    print("no")

Submission status: Runtime Error

Solution code:
n = int(input())
eq_count = 0
times_count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        exit()
print('No')

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
for i in range(n):
  a,b=list(map(int,input().split()))
  l.append(l)
c=0  
for i in l:
  if i[0]==i[1] and i+1[0]==i+1[1] and i+2[0]==i+2[1]:
    c=c+1
if c>=1:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
dice_num_list = []
equal_index_list = []

N = int(input())

for i in range(1, N + 1):
    d1, d2 = input().split(" ")
    dice_num_list.append([d1, d2])

equal_index_list = [i for i, x in enumerate(dice_num_list) if x[0] == x[1]]

if len(equal_index_list) < 3:
    print('No')
    exit(0)
for index in equal_index_list:
    if equal_index_list[index + 1] == index + 1 and equal_index_list[index + 2] == index + 2:
        print("Yes")
        exit(0)
print("No")

Submission status: Runtime Error

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

count = 0
for j in range(len(D1)):
    if D1[j] == D1[j+1] == D1[j+2]:
        count = count + 1
        break
if count == 1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
import os,sys
c=0

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

Submission status: Runtime Error

Solution code:
n=input()
c=[[]*n]
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    c[i]=1
  else:
    c[i]=0
cnt=0
for j in range(n):
  if c[j]==1:
    cnt+=1
  if cnt==3:
    print("Yes")
    break

Submission status: Runtime Error

Solution code:
n=int(input())
l1=[]
sum =0
for tc in range(n):
    k = int(input())
    l = int(input())
    if k==l:
        l1.append(1)
    else:
        l1.append(0)
for i in range(3):        
      sum+=l1[i]  
        
        
if sum == 3:
    print("Yes")
    
else:
    for i in range(0,n-2):
        sum = sum-l1[i]+l1[i+2]
        if sum ==3:
            print("Yes")
            break
    
        
        
if sum<3:
    print("No")

Submission status: Runtime Error

Solution code:
n=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(n):
  if c[j]==1:
    cnt+=1
  if cnt==3:
    print("Yes")
    break
if cnt<3:
  print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
d = []
for i in range(n + 1):
    d.append(list(map(int, input().split())))
    if (d[i][1] == d[i][2]) and (d[i + 1][1] == d[i + 1][2]) and (d[i + 2][1] == d[i + 2][2]):
        print("Yes")
        break
    else:
        print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]
count = 0
for i in range(len((l)):
    x, y = l[i]
    print(x, y)
    if x==y:
        count+=1
        if count==3:
            print(Yes)
            break
    else:
        count = 0
if count!=3:
    print(No)

Submission status: Runtime Error

Solution code:
N = int(input())
l = [list(map(int, input().split())) for l in range(N)]
count = 0
for i in range(len((l)):
    x, y = l[i]
    if x==y:
        count+=1
        if count==3:
            print(True)
            break
    else:
        count = 0
print(False)

Submission status: Runtime Error

Solution code:
n = int(input())

for _ in range(n):
    d1, d2 = map(int, input().split(" "))
    if d1 == d2:
        count += 1
if count >= 3:
    print("yes")
else:
    print("no")

Submission status: Runtime Error

Solution code:
n = int(input())
count = 0
flag = False
while count < n:
  a, b = map(int, input().split())
  count += 1
  if a == b and count <= n:
    a, b = map(int, input().split())
    count += 1
    if a == b and count <= n:
      a, b = map(int, input().split())
      count += 1
      if a == b and count <= n:
        flag = True
        print("Yes")
        break

if flag == False:
  print("No")

Submission status: Runtime Error

Solution code:
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]:
  	print('Yes')
    break
  elif i == n-3:
    print('No')
    break

Submission status: Runtime Error

Solution code:
n = int( input() )
#print( n )

cnt = 0
for i in range( n ):
    a, b = map( int, input().split() )
    if a == b:
        cnt = cnt + 1
    else:
        cnt = 0

    if cnt == 3:
        exit( "Yes" )


print( "No" )

Submission status: Runtime Error

Solution code:
n=int(input())
c=0
for i in range(n):
  x,y=intput().split()
  x=int(x)
  y=int(y)
  if x==y:
    c+=1
  if c==3:
    print("Yes")
  else:
    print("No")

Submission status: Runtime Error

Solution code:
N = input()
a = []
b = []
flg = False
for i in range(N):
    x, y = input().split()
    a.append(x)
    b.append(y)

for i in range(N):
    if (a[i - 2] == b[i - 2]):
        if (a[i - 1] == b[i - 1]):
            if(a[i] == b[i]):
                flg = True
                break
                
print(flg if "Yes" else "No")

Submission status: Runtime Error

Solution code:
a=int(input())
b=0
xy = [map(int, input().split()) for _ in range(a)]
x, y = [list(i) for i in zip(*xy)]
for i in range(a-2):
  if x[i]==y[i] and x=[i+1]==y[i+1] and x=[i+2]==y[i+2]:
    b=b+1
if b==0:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())
li = [0] * n
for i in range(n):
    a, b = [int(x) for x in input().split()]
    li.append([a,b])
count = 0
for i in li:
    if i[0] == i[1]:
        count += 1
    else:
        count = 0

if count == 0: print('Yes')
else: print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A = list(map(int, input().split()))
N = A[0]
D = A[1:N*2+1]
D1 = []
D2 = []
for i in range(N):
    D1.append(D[2 * i])
    D2.append(D[2 * i + 1])
ans = "No"
for i in range(N - 2):
    if D1[i] == D[i]:
         if D[i + 1] == D[i + 1]:
            if D[i + 2] == D[i + 2]:
                ans = "Yes"
                break
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
c=0
for i in range(n):
  x,y=intput().split()
  x=int(x)
  y=int(y)
  if x==y:
    c+=1
if c==3:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
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
    elif ans >= 3:
        flag = True
        ans = 0
    else:
        ans = 0
        
if ans >= 3 or flag ==True:
    print("Yes")
    
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())

D = []
for i in range(N):
    Da,Db = (map(int,input().split()))
    if Da == Db:
        D.append(1)
    else:
        D.append(0)

for i in range(N-2):
    if D[i]==1 and D[i+1] == 1 and D[i+2] == 1:
        ans = "Yes"
        break:
    else:
        ans = "No"
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]
​
cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:        
        print("Yes")
        break
else:
    print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]
​
cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:        
        print("Yes")
        break
else:
    print("No")
5

Submission status: Runtime Error

Solution code:
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
    elif ans >= 3:
        flag = True
    else:
        ans = 0
        
if ans >= 3 or flag ==True:
    print("Yes")
    
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = str(input())

count = 0
yes = False

for i in range(N):
  a , b = map(int, input().split())
  
  if a==b:
    count +=1
    if count >= 3:
      print("Yes")
      yes = True
      break
  else:
    count = 0

if not(yes):
  print("No")

Submission status: Runtime Error

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

        if d[i]-d[i-1]==1 and d[i+1]-d[i]==1:
            print("Yes")
            c=False
            break

    if c==False:
        print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
count=0

for num in range(n):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        count += 1
else:
    if count>0:
        print("Yes")
    else:
        print("No")v

Submission status: Runtime Error

Solution code:
N = str(input())

count = 0
yes = False

for i in range(N):
  a , b = map(int, input().split())
  
  if a==b:
    count +=1
    if count >= 3:
      print("Yes")
      yes = True
      break
  else:
    count = 0

if !yes:
  print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
a = []
b = []
flg = False
for i in range(N):
    x, y = (map(int, input().split()))
    a.append(x)
    b.append(y)

for i in range(N):
    if flg: break
    if (a[i - 2] == b[i - 2]):
        if (a[i + 1] == b[i + 1]):
            if(a[i] == b[i]):
                flg = True
                break
                
print(flg if "Yes" else "No")

Submission status: Runtime Error

Solution code:
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]

flg = False
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:        
        print("Yes")
        break
else:
    print("No")

Submission status: Runtime Error

Solution code:
a=int(input())
b=0
xy = [map(int, input().split()) for in range(a)]
for i in range(a-2):
  if a[i]==a[i+1]==a[i+2]:
    b=b+1
if b==0:
  print("No")
else:
  print("Yes")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int( input() )
#print( n )

d1 = [ 0 ] * n
d2 = [ 0 ] * n
#print( d1, d2 )

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

#print( d1, d2 )


for i in range( n-2 ):
    if d1[ i ] == d2[ i ]:
        if d1[ i+1 ] == d2[ i+1 ]:
            if d1[ i+2 ] == d2[ i+2 ]:
                exit( "Yes" )

print( "No" )

Submission status: Runtime Error

Solution code:

Copy
Copy
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input().split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
a = []
b = []
flg = False
for i in range(N):
    x, y = (map(int, input().split()))
    a.append(x)
    b.append(y)

for i in range(N):
    if flg: break
    if (a[i] == b[i]):
        if (a[i + 1] == b[i + 1]):
            if(a[i + 2] == b[i + 2]):
                flg = True
                break
                
print(flg if "Yes" else "No")

Submission status: Runtime Error

Solution code:
N = int(input())
lst = []
for _ in range(N):
  d1, d2 = map(int, input.split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Submission status: Runtime Error

Solution code:
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-1):
  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")

Submission status: Runtime Error

Solution code:
N = int(input())
count = 0
c = 0
for i in range(N):
    d1,d2 = input().split()
    if d1==d2:
        count+=1
        if count==3:
            c =1
            sys.exit()
    else:
        count=0
if count==1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
S = []
for _ in range(N):
  S.append(input().split())
G = []
for i in range(N):
  if S[i][0] == S[i][1]:
    G.append("1")
  else:
    G.append("0")

AN = (''.join(G))

if "111" in AN:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
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(N):
  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")

Submission status: Runtime Error

Solution code:
N = int(input())
count=0
for i in range(N):
  p,q=map(int,input().split(' '))
  if count<3:
	if p==q:
      count+=1
    else:
      count=0
  else:
    pass
if count>=3:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N = input()
count = 0
c = 0
for i in range(N):
    d1,d2,d3 = input().split()
    if (d1==d2)&(d2==d3):
        count+=1
        if count=3:
            c =1
            sys.exit()
    else:
        count=0
if count=1:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
D = 0

for i in range(N + 1):
    D1, D2 = map(int, input().split())
    if D == 3:
        break

    if D1 == D2:
        D += 1

    elif D1 != D2:
        D = 0

if D == 3:
    print('Yes')
else:
    print('No')

Submission status: Runtime Error

Solution code:
n=int(input("enter n"))
for i in range(0,n):
  count=0
  m=int(input("enter m"))
  o=int(input("emter o"))
  if(m==0):
    count=count+1
if(count%3==0):
  print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N = input()
lst = []
for _ in range(N):
  d1, d2 = map(int, input.split(' '))
  lst.append((d1, d2))
  
idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = lst[idx]
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Submission status: Runtime Error

Solution code:
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:
      break
  else:
    a=0
    
if a>=3:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
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')
        break

if cou == 0:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
D = []
for i in range(N):
    a = list(map(int,input().split()))
    if(a[0] == a[1]):
        D.append(1)
    else:
        D.append(0)
for i in range(N-2):
    if D[i] == D[i+1] == D[i+2] == 1:
        tf = 1
if tf == 1:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
rows = int(input())
x = []
for i in range(rows):
    x.append(list(map(int, input().split())))
    
for i in range(len(x)):
  if x[i][0]==x[i][1]:
    if [i+1][0]==[i+1][1]:
      if [i+2][0]==[i+2][1]:
        print('Yes')
      else:
        print('No')
    else:
      print('No')
        
  else:
    print('No')

Submission status: Runtime Error

Solution code:
n=int(input())
flag=0
for i in range(n):
    d1,d2=map(int,input().split())
    if d1==d2:
        flag+=1
        if flag==3:
            ans=1
    else:
        flag=0
if ans!=1:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
N = input()
count = []
for i in range(N):
    d1,d2,d3 = input().split()
    if (d1==d2)&(d2==d3):
        print('Yes')
        sys.exit()
    else:
        count.append(0)
if sum(count)==0:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
s = []
a = 0

for i in range(n):
  d = list(map(int, input().split()))
  s.append(d)

for i in range(n):
  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")
        a += 1
        break

if a == 0:
  print("No")

Submission status: Runtime Error

Solution code:
N=int(input())
j=0
for i in range(N):
  D1,D2=map(int,input().split())
  if D1==D2:
    j+=1
    if j>=3:
      J=3
  else:
    j=0
if J>=3:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N=int(input())
D={}
for i in range(N):
    D=[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')
        break

if cou == 0:
    print('No')

Submission status: Runtime Error

Solution code:
N= int(input())
count=0
for i in range(N):
  p,q=map(int,input().split(' '))
  if p==q:
    count+=1
	else:
    count=0

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

Submission status: Runtime Error

Solution code:
N = int(input())
nums =[]
count = 0
switch = False
for i in range(N):
    nums.append([int(x) for x in input().split()]

for j in nums:
    if j[0] == j[1]:
        count += 1
    elif j[0] != j[1]:
        count = 0
    if count == 3:
        switch = True
if switch == True:
    print("Yes")
elif switch == False:
    print("No")

Submission status: Runtime Error

Solution code:
N = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
count = 0

for i in range(N-1):
  if x[i] == y[i]:
    count += 1
    if count >= 3:
      flag = 1
  else:
    count = 0
  

if flag == 1:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N=int(input())
D={}
for i in range(N):
    D=[input().split()]
    for w in range(2):
        D[i][w]=int(D[i][w])

cou=0
for i in range(N):
    if D[i][0]==D[i][1]:
        cou+=1
    else:
        cou=0
    
    if cou == 3:
        print('Yes')
        break

if cou == 0:
    print('No')

Submission status: Runtime Error

Solution code:
N = int(input())
count = 0
for i in range(N):
  a,b = map(int,input().sprit())
  if a == b:
    count+=1
    if count = 3:
      print("Yes")
      break
  else:
    count = 0
print("No")

Submission status: Runtime Error

Solution code:
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):
    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")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = input()

idx = 0
while idx < N-3:
  cnt = 0
  for _ in range(3):
    d1, d2 = map(int, input.split(' '))
    if d1 == d2:
      cnt += 1
  
  if cnt == 3:
    print('Yes')
    break
  else:
    idx += 1
print('No')

Submission status: Runtime Error

Solution code:
N = int(input())

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

for i in range(N):
    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)

Submission status: Runtime Error

Solution code:
n=int(input())

count=0
c_list=[]
for i in range(n):
    d1, d2=map(int, input().split())
    if d1==d2:
        count+=1
        c_list.append(count)
    else:
        count=0
        
if max(c_list)>=3:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N=int(input())
sum=0
for _ in range(N):
    a,b=map(int,input().split())
    if(a==b):
        sum+=1
        if(sum==3):
            name=[]
            name.append("Yes")
    else:
        sum=0
    
if name[0]=="Yes":
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n=int(input())
count=0
ren=0
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    if count<3:
      count+=1
      ren=1
  else if count<3:
    count=0
if count>=3:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
N= int(input())
count=0
for i in range(N):
	p,q=list(map(int,input().split(' ')))
    if p==q:
		count+=1
	else:
      	count=0

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

Submission status: Runtime Error

Solution code:
    doubletCount = 0
    cases = int(input())
    for roll in range(cases):
        d1, d2 = map(int, input().split())
        if d1 == d2:
            doubletCount += 1
        else:
            doubletCount = 0
            
        if doubletCount >= 3:
            print("Yes")
            break
        
        if roll == cases - 1:
            print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
z = []
y = 0
for i in range(n):
  line = input().split(" ")
  if int(line[0])==int(line[1]):
    z.append(int(line[0]))

for i in range(n-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")

Submission status: Runtime Error

Solution code:
n =int(input())
l1 = []
for i in range(n):
   l2=[]
    k = int(input())
    l = int(input())
    l2.append(k)
    l2.append(l)
    l1.append(l2)
for i in range(n):
  if l1[i][0]==l1[i][1]:
    res+=1
if res>=3:
   print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
from sys import stdin
def ip(): return [int(i) for i in stdin.readline().split()]
def sp(): return [str(i) for i in stdin.readline().split()]


n = int(input())
row = False
cnt = 0
for _ in range(n):
    x,y = ip()
    if x == y: cnt += 1
    else:
        cnt += 1
    if cnt == 3:
    row = True

if row: print("Yes")
else: print("No")

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
num_of_double = 0

for i in range(n):
    d1 = int(input())
    d2 = int(input())

    if d1 == d2:
        num_of_double += 1

if num_of_double >= 3:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
N= int(input())
count=0
for i in range(N):
	p,q=map(int,input().split(' '))
    if p==q:
		count+=1
	else:
      	count=0

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

Submission status: Runtime Error

Solution code:
n=int(input())

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

print("No")

Submission status: Runtime Error

Solution code:
n = int(input())
t = []
i = 0
for _ in range(n):
    x, y = map(int, input().split())
    if x == y:
        i += 1
    else:
        i = 0
    t.append(i)
if(len(filter(lambda x: x >= 3, t)) == 0):
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
n = int(input())
l=[]
for i in range(n):
  a,b = list(map(int,list(input().split())))
  l.append([a,b])
def fn(n,l):
  for i in range(n-2):
    if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] andl[i+2][0]==l[i+2][1]:
      return 'Yes'
  return 'No'  
print(fn(n,l))

Submission status: Runtime Error

Solution code:
N = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
flag = 0

for i in range(N-3):
  if x[i] == y[i]:
    if x[i+1] == y[i+1]:
      if x[i+2] == y[i+2]:
        flag = 1

if flag == 1:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
N=int(input())
x = [list(map(int, input().split())) for i in range(N)]
count=0
for i in range(N-2):
  if x[i][0]==x[i][1] and x[i+1][0]==x[i+1][1] and x[i+2][0]==x[i+2][1]:
     count=count+1
  else:
     count=count
else:
  if count>0 :
    print'Yes'
  else :
    print'No'

Submission status: Runtime Error

Solution code:
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(n-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")

Submission status: Runtime Error

Solution code:
i = input()
idx = 0

while idx < i:
  	cnt = 0
	for _ in range(3):
      d1, d2 = list(map(int, input.split(' ')))
      if d1 == d2:
        cnt += 1
    if cnt == 3:
      print('Yes')
    else:
      idx += 1

print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in n:
    x,y = map(int,input().split())
    a.append([x,y])
count = 0
flag = True
for x in a:
    if x[0] == x[1]:
        count += 1
        if count == 3:
            print('Yes')
            flag = False
            break
    else:
        count = 0

if flag:
    print('No')

Submission status: Runtime Error

Solution code:
n = int(input)
count = 0
ans = 'No'
for _ in range(n):
	a , b = map(int,input().split(' '))
    if a!=b:
    	count = 0 
    else:
    	count += 1
    if count == 3:
    	ans = 'Yes'
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]
flag = 0
for i in range(N-2):
  if x[i] == y[i]:
    if x[i+1] == y[i+1]:
      if x[i+2] == y[i+2]:
        flag = 1

if flag == 1:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
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(n-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")

Submission status: Runtime Error

Solution code:
i = input()
idx = 0

while idx < i:
  	cnt = 0
	for _ in range(3):
      d1, d2 = list(map(int, input.split(' ')))
      if d1 == d2:
        cnt += 1
    if cnt == 3:
      return 'Yes'
    else:
      idx += 3

print('No')

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
j=0
for i in range(n):
  a=list(map(int,input().split()))
  l.append(a)
for k in range(n-2):
  if l[k+2][0]==l[k+2][1] and l[k+3][0]==l[k+1][1] and l[k+4][0]==l[k+4][1]:
    j+=1
    break
if j==1:
  print('Yes')
else:
  print('No')

Submission status: Runtime Error

Solution code:
n = int(input())
a = []
for i in n:
    x,y = map(int,input())
    a.append([x,y])
count = 0
flag = True
for x in a:
    if x[0] == x[1]:
        count += 1
        if count == 3:
            print('Yes')
            flag = False
            break
    else:
        count = 0

if flag:
    print('No')