Problem: 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.

Submission attempts (in order):
d1,d2 = [],[]
n = int(input())
for i in range(n):
    a,b=map(int,input().split())
    d1.append(a)
    d2.append(b)
for i in n-2:
  if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
	print("Yes")
  return 0

print("No")


ans = 0
count = 0
list = []
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

if ans == 1:
  print("Yes")
else print("No")


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

print("No")

ans = 0
count = 0
list = []
for i in range(100):
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l+1:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

if ans == 1:
  print("Yes")
else :print("No")

ans = 0
count = 0
for i in sys.stdin:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for 1 in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      and = 1
  else:
    count = 0

if ans == 1:
  print("Yes")
else print("No")

d1,d2 = [],[]
n = int(input())
for i in range(n):
    a,b=input().split()
    d1.append(a)
    d2.append(b)
for i in n-2:
  if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
	print("Yes")
  return 0

print("No")


ans = 0
count = 0
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      ans = 1
  else:
    count = 0

if ans == 1:
  print("Yes")
else print("No")


list = []
n = input()
for i in range(n):
    a,b=input().split()
    list.append((int(a), int(b)))
for i in n-2:
  if list[i][0] == list[i][1] and list[i+1][0] == list[i+1][1] and list[i+2][0] == list[i+2][1]:
	print("Yes")
  return 0

print("No")


list = []
n = input()
for i in range(n):
    a,b=input().split()
    list.append((int(a), int(b)))
for i in n-2:
  if list[i][0] == list[i][1] and list[i+1][0] == list[i+1][1] and list[i+2][0] == list[i+2][1]:
	print("Yes")
  return 0

else :print("No")

count = 0
n = int(input())
for i in range(n):
  a,b=map(int,input().split())
  if a == b:
    count += 1
    if count >= 3:
		print("Yes")
  	return 0

print("No")


ans = 0
count = 0
for i in 100:
    a,b=input().split()
    list.append((int(a), int(b)))
l = list[0][0]
for i in l:
  if list[i][0] == list[i][1]:
    count += 1
    if count >= 3:
      and = 1
  else:
    count = 0

if ans == 1:
  print("Yes")
else print("No")


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

print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted