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

Solution (Python):
N=int(input())
DD=[]
for i in range(N):
    DD.append(list(map(int,input().split())))
for i in range(N-2):
    if DD[i][0]==DD[i][1]:
        if DD[i+1][0]==DD[i+1][1]:
            if DD[i+2][0]==DD[i+2][1]:
                print("Yes")
                break
            elif i+2==N-1:
                print("No")
                break
        elif i+1==N-2:
            print("No")
            break
    elif i==N-3:
        print("No")
        break

Solution (Python):
N=int(input())
cnt=0
list1=[]
for i in range(N):
  a=input().split()
  if a[0]==a[1]:
    list1.append(i)
moji=''.join(map(str, list1))
for j in range(N):
  a=str(j)+str(j+1)+str(j+2)
  if a in moji:
    cnt=1
    break
print("Yes"*cnt+"No"*(1-cnt))

Solution (Python):
n=int(input())
S=[]
for i in range(n) :
    s=list(map(int,input().split()))
    S.append(s)

count=0
for i in range(n) :
    if S[i][0]==S[i][1] :
        count+=1
    if count==3 :
        print("Yes")
        exit()
    if S[i][0]!=S[i][1] :
        count=0

print("No")

Solution (Python):
def ProgramB():
    
    num = int(input())
    
    count = 0
    max_count = 0

    for i in range(num):
        data = list(map(int,input().split()))

        if num == 0:

            if data[0] == data[1]:
                count = count + 1
                
                if count > max_count:
                    max_count = count
    
            else:
                count = 0

        else:
            if data[0] == data[1]:
                count = count + 1
                
                if count > max_count:
                    max_count = count
    
            else:
                count = 0
            
            
    if max_count >= 3:        
        print('Yes')
        
    else:
        print('No')
        
        
if __name__ == '__main__':
    ProgramB()

Solution (Python):
n=int(input())
count = 0
last = 0
for a in range(n):
    z = list(input().split())
    if int(z[0]) == int(z[1]):
        count+=1
        if count >= 3:
            last = 1
    if int(z[0]) != int(z[1]):
        if count > 0:
            count = 0
        else:
            continue
if last == 1:
    print("Yes")
if last == 0:
    print("No")

Solution (Python):
n=int(input())
d=[input().split() for i in range(n)]
flag=False
for i in range(n-2):
  if d[i][0]==d[i][1]:
    if d[i+1][0]==d[i+1][1]:
      if d[i+2][0]==d[i+2][1]:
        flag=True
print("Yes" if flag else "No")

Solution (Python):
n = int(input())
flag = [-1]*3
ans = 0
for i in range(n):
    a,b = map(int,input().split())
    flag[0] = flag[1]
    flag[1] = flag[2]
    if a == b:
        flag[2] = 1
    else:
        flag[2] = 0
    if flag[0] == 1:
        if flag[1] == 1:
            if flag[2] == 1:
                ans = 1

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

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

Solution (Python):
N = int(input())
D = []
is_Zorome = []
for _ in range(N):
  inputs = input().split(' ')
  D.append(inputs)
  if inputs[0] == inputs[1]:
    is_Zorome.append(True)
  else:
    is_Zorome.append(False)

answer = 'No'

for i in range(N-2):
  if is_Zorome[i] and is_Zorome[i+1] and is_Zorome[i+2]:
    answer = 'Yes'

print(answer)

Solution (Python):

def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    q_num = input_int()

    count_num = 0

    for _ in range(q_num):

        a, b = input_int_map()

        if a == b:
            count_num += 1

            if count_num == 3:
                print('Yes')
                return
        else:
            count_num = 0
    print('No')

run()

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

ans = 0

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 += 1
    else:
        ans += 0
        
if ans >= 1:
    print("Yes")
else:
    print("No")

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

for i in range(n):
    if d[i][0] == d[i][1]:
        x += 1
    else:
        x = 0
    if x == 3:
        print("Yes")
        exit()
print("No")

Solution (Python):
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:
    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)

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

count = 0
flag =0
for i in range(N):
    if D[i][0] == D[i][1]:
        count += 1
    else :
        count = 0
    if count >2 :
        flag=1;

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

Solution (Python):
n = int(input())
d = [list(map(int,input().split())) for i in range(n)]
cnt=[]
ans=0
for a in range(n):
  if d[a][0]==d[a][1]:
    cnt.append(1)
    if a>1:
      if cnt[a-2]==cnt[a-1]==cnt[a]:
        ans+=1
  else:
    cnt.append(0)

if ans >0:
  print('Yes')
else:
  print('No')

Solution (Python):
N = int(input())
D = [list(input()) for _ in range(N)]

cnt = 0

for j in range(N):
    if D[j][0] == D[j][2]:
        cnt +=1 
    elif cnt < 3 and D[j][0] != D[j][2]:
        cnt = 0

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

Solution (Python):
n = int(input())
s = [list(map(int, input().split())) for i in range(n)]
cnt = 0
ans = 0
for i in range(n):
  if len(set(s[i])) == 1:
    cnt += 1
  else:
    cnt = 0
  if cnt == 3:
    ans = 1

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

Solution (Python):
def main():
    N = int(input())
    list_D = [input() for i in range(N)]

    answer = "No"
    counter = 0
    for D in list_D:
        D1, D2 = D.split()

        if D1 == D2:
            counter = counter + 1

            if counter == 3:
                answer = "Yes"
                break

        else:
            counter = 0
    
    print(answer)

if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
arr=[[-1 for j in range(2)] for i in range(N)]
for i in range(N):
	arr[i][0],arr[i][1]=map(int,input().split())
cnt=0
for i in range(N-2):
	if arr[i][0]==arr[i][1] and arr[i+1][0]==arr[i+1][1] and arr[i+2][0]==arr[i+2][1]:
		cnt+=1
if cnt>0:
	print("Yes")
else:
	print("No")

Solution (Python):
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(0,N-2):
    if x[i]==y[i]:
        if x[i+1]==y[i+1]:
            if x[i+2]==y[i+2]:
                count = count+1
            else:
                pass
        else:
            pass
    else:
        pass

if count>0:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
ans = ""
for i in range(n):
  t1, t2 = list(map(int, input().split()))
  if t1 == t2:
    ans += "1"
  else:
    ans += "0"
if "111" in ans:
  print("Yes")
else:
  print("No")

Solution (Python):
a = [len(set(input().split())) == 1 for _ in range(int(input()))]
print('NYoe s'[any(map(all, zip(a, a[1:], a[2:])))::2])

Solution (Python):


n = int(input())
a = [0]*n
b = [0]*n

ans = 'No'

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


for i in range(n-2):
    if a[i] == b[i]:
        if a[i+1]==b[i+1] and a[i+2]==b[i+2]:
            ans = 'Yes'
            exit

print(ans)

Solution (Python):
n = int(input())
d = [list(map(int, input().split())) for i in range(n)]
cnt = 0

for i in range(0, n-2):
    cnt = 0
    if d[i][0] == d[i][1]:
        cnt += 1

        if d[i+1][0] == d[i+1][1]:
            cnt += 1

            if d[i + 2][0] == d[i + 2][1]:
                cnt += 1
                break

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

Solution (Python):
n=int(input())
c=0
o=""
for _ in range(n):
	d,d1=map(int,input().split())
	if d==d1:
		c+=1
		if c==3:
			o="Yes"
	else:
		c=0
if o=="":
	o="No"
print(o)

Solution (Python):
N = int(input())
deme = []
flag = False
cnt = 0

for i in range(N):
    x, y = input().strip().split()
    
    
    x = int(x)
    y = int(y)
    if x == y:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        flag = True

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

Solution (Python):
n = int(input())
cnt = 0
dd = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
  if dd[i][0]==dd[i][1]:
    cnt += 1
    if cnt >= 3:
      print('Yes')
      exit()
  else:
    cnt = 0
print('No')

Solution (Python):
n=int(input())
ct=0
f=False
for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    ct+=1
  else:
    ct=0
  if ct==3:
    f=True
print("Yes" if f else "No")

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

T=0
for i in range(0,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]:
    T+=1
  else:
    continue
    
if T!=0:
  print ('Yes')
else:
  print ('No')

Solution (Python):
n = int(input())
d = []
for _ in range(n):
    d1, d2 = input().split()
    if d1 == d2:
        d.append(1)
    else:
        d.append(0)
for i in range(len(d)-2):
    if sum(d[i:i+3]) == 3:
        print('Yes')
        break
else:
    print('No')

Solution (Python):
N = int(input())
c = 0
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 != d2:
        c = 0
    elif c == 2:
        print("Yes")
        exit()
    else:
        c += 1
print("No")

Solution (Python):
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 = 0
    if cnt == 3:
        row = True

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

Solution (Python):
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
  elif count<3:
    count=0
if count>=3:
  print("Yes")
else:
  print("No")

Solution (Python):
def main():
	N = int(input())
	cnt = 0
	ans = "No"
	for n in range(N):
		D = list(map(int,input().split()))
		if D[0] == D[1]:
			cnt += 1
			if cnt >= 3:
				ans = "Yes"
				break
		else:
			cnt = 0
	print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
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+0
else:
  if count>0 :
    print('Yes')
  else :
    print('No')

Solution (Python):
n = int(input())

count = 0
flag = False
for i in range(n):
  a1, a2 = map(int, input().split())
  if a1 == a2:
    count += 1
    if(count == 3):
      flag = True
  else:
    count = 0

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

Solution (Python):
def main():
    n = int(input())
    d = []
    for i in range(n):
        d.append(list(map(int,input().split())))
    d_set = list(map(set,d))
    cnt = 0
    ans = 'No'
    for i in d_set:
        if len(i)==1:
            cnt += 1
        else:
            cnt = 0
        if cnt >= 3:
            ans = 'Yes'
            break
    print(ans)



if __name__ == '__main__':
    main()

Solution (Python):
n = input()
dlist = []
count = 0

for i in range(int(n)):
  d = input().split()
  dlist.append(d)

for j in range(int(n)):
  if dlist[j][0] == dlist[j][1]:
    count += 1
    if count == 3:
      break
  else:
    count = 0

if count == 3:
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
tab = []
good = 0
for i in range(n):
	a, b = map(int, input().split())
	tab.append([a, b])
	if i > 1:
		if tab[-1][0] == tab[-1][1] and tab[-2][0] == tab[-2][1] and tab[-3][0] == tab[-3][1]:
			good = 1
	
if good:
	print('Yes')
else:
	print('No')

Solution (Python):
n = int(input())

cnt = 0

for i in range(n):
    a,b = map(int,input().split())
    if a == b:
        cnt += 1
    elif a != b:
        cnt = 0
        
    if cnt == 3:
        print('Yes')
        exit()
        
print('No')

Solution (Python):
n=int(input())
count=0
counts=[]
z=[]
for i in range(n):
	x,y=list(map(int,input().split()))
	z.append([x,y])
z.append([-14,-20])
for i in z:
	if i[0]==i[1]:
		count+=1
	else:
		counts.append(count)
		count=0
if max(counts)>=3:
	print('Yes')
else:
	print('No')

Solution (Python):
N = int(input())

d  = []
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        ans = "same"
    else:
        ans = "different"
    d.append(ans)
flag = "No"
for i in range(N-2):
    if d[i] == "same" and d[i+1] == "same" and d[i+2] == "same":
        flag = "Yes"
print(flag)

Solution (Python):
import sys
N = int(input())
count = 0
for i in range(N):
    tmp = input().split()
    if tmp[0] == tmp[1]:
      count = count + 1
      if count >= 3:
        print("Yes")
        sys.exit()
    else:
      count = 0;

print("No")

Solution (Python):
def checkDoublet(arr):
    count = 0
    for d in arr:
        if d[0] == d[1]:
            count += 1
            if count >= 3:
                return 'Yes'
        else:
            count = 0
    return 'No'

n = int(input())
arr = []
for i in range(n):
    arr.append(list(map(int, input().rstrip().split())))
print(checkDoublet(arr))

Solution (Python):
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
 


def main():
    n = int(input())
    count = 0
    flag = False
    for i in range(n):
        x,y = map(int, input().split())
        if x == y:
            count += 1
        else:
            count = 0
        
        if count == 3:
            flag = True

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

if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
ans=0
result = 0
for i in range(N):
  a,b = map(int,input().split())
  if a == b:
    ans += 1
    if ans >= 3:
      result += 1
  else:
    ans = 0
if result >=1:
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
l=[]
k=0
for i in range(n):
    d=[x for x in input().split()]
    l.append(d)
    
for i in range(n-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]:
        k+=1
        break

if k==0:
    print("No")
else:
    print("Yes")

Solution (Python):
n = int(input())

count = 0

for i in range(n):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    count += 1
  else:
    count = 0
  if 3 <= count:
    s = 'Yes'
    break
  else:
    s = 'No'

print(s)

Solution (Python):
N = int(input())

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

count = [0]
for p in P:
    if p[0] == p[1]:
        count.append(count[-1]+1)
    else:
        count.append(0)

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

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

Solution (Python):
import numpy as np
N = int(input())
ary = np.array([list(map(int, input().split())) for i in range(N)])

zoro = (ary[:, 0] == ary[:, 1]).astype(int)

f = "No"
for i in range(len(zoro) - 2):
  if zoro[i] + zoro[i+1] + zoro[i+2] == 3:
    f = "Yes"
    break

print(f)

Solution (Python):
N = int(input())
c = 0
f = 0
for i in range(N):
  a, b = map(int, input().split())
  if a == b:
    c += 1
  else:
    c = 0
  if c == 3:
    f = 1
if f == 0:
  print("No")
else:
  print("Yes")

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

ans = 0

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

        if ans == 3:
            break

    else:
        ans = 0


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

Solution (Python):
N = int(input())

count = 0
for _ in range(N):
  D = map(int, input().split())
  D = list(D)
  if D[0] == D[1]:
    count += 1
    if count >= 3:
      print('Yes')
      break
    continue
  count = 0
else:
  print('No')

Solution (Python):
N = int(input())
D = [[int(s) for s in input().split()] for _ in range(N)]

result = 'No'
for d1, d2, d3 in zip(D, D[1:], D[2:]):
    if d1[0] == d1[1] and d2[0] == d2[1] and d3[0] == d3[1]:
        result = 'Yes'

print(result)

Solution (Python):
n = int(input())

nums = []
for i in range(n):
    [d_1,d_2] = input().split()
    d_1 = int(d_1)
    d_2 = int(d_2)
    nums.append([d_1,d_2])

ans = "No"
for i in range(0,n-2):
    count = 0
    for j in range(3):
        if nums[i + j][0] == nums[i + j][1]:
            count += 1
    if count == 3:
        ans = "Yes"
        break

print(ans)

Solution (Python):
x=int(input())
List=[]
counter=0
for i in range(x):
  List.append(list(map(int,input().split())))
for i in range(len(List)):
  if List[i][0]==List[i][1]:
    counter+=1
  else:
    counter=0
  if counter ==3:
    print("Yes")
    break
if counter<3:
  print("No")

Solution (Python):
n = int(input())
num_list = []
for i in range(n):
  num_list.append(list(map(int,input().split())))

k = 0
for i in range(n-2):
  if num_list[i][0] == num_list[i][1]:
    if num_list[i+1][0] == num_list[i+1][1]:
      if num_list[i+2][0] == num_list[i+2][1]:
        print('Yes')
        k += 1
        break
if k == 0:
  print('No')

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

if ans == 0 or ans == 1 or ans == 2:
    print("No")

Solution (Python):
N = int(input())
z = 0
f = False
for i in range(N):
    r = list(map(int, input().split()))
    if r[0] == r[1]:
        z += 1
        if z == 3:
            f = True
    elif not f:
        f = False
        z = 0
if f:
    print("Yes")
else:
    print("No")

Solution (Python):
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] and l[i+2][0]==l[i+2][1]:
      return 'Yes'
  return 'No'  
print(fn(n,l))

Solution (Python):
n = int(input())

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

def dice():
    cnt =0
    for i in range(n):
        if d[i][0] == d[i][1]:
            cnt += 1
            if cnt == 3:
                return "Yes"
                break
        else:
            cnt = 0
    return "No"

ans = dice()

print(ans)

Solution (Python):
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(list(filter(lambda x: x >= 3, t))) == 0):
    print("No")
else:
    print("Yes")

Solution (Python):
N = int(input(""))
L = [0 for i in range(N)]
flag = False

for i in range(N):
    a, b = input().strip().split()
    a, b = [int(a), int(b)]
    L[i] = a - b
for i in range(N - 2):
    if (L[i] == 0 and L[i+1] == 0 and L[i+2] == 0):
        flag = True

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

Solution (Python):
N = int(input())
D1 = [0]*N
D2 = [0]*N
for i in range(N):
    D1[i], D2[i] = map(int, input().split())

table = [False]*N
key = False

for i in range(N):
    if D1[i]==D2[i]:
        table[i] = True
    if (i>=2 and key == False):
        if (table[i]==True and table[i-1]==True and table[i-2]==True):
            key = True

if key==True:
    ans = "Yes"
else:
    ans = "No"
    
print(ans)

Solution (Python):
n=int(input())

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

print("No")

Solution (Python):
N=int(input())
i=0
l=[]
for i in range(0,N):
    a,b=input().split()
    l.append(a)
    l.append(b)
    i+=1
i=0
c=0
for i in range(0,2*N):
    if i==2*N-4:
        break
    if l[i]==l[i+1]:
        if l[i+2]==l[i+3]:
            if l[i+4]==l[i+5]:
                c+=1
                break
            else:
                if i+6<2*N-5:
                    i+=6
        else:
            if i+4<2*N-3:
                i+=4
    else:
        i+=2
if c==0:
    print("No")
else:
    print("Yes")

Solution (Python):
N = int(input())

count = 0
for _ in range(N):
  D = map(int, input().split())
  D = list(D)
  if D[0] == D[1]:
    count += 1
    if count >= 3:
      print('Yes')
      break
    continue
  count = 0
else:
  print('No')

Solution (Python):
N=int(input())
d=[list(map(int,input().split())) for x in range(N)]

for i in range(N-2):
	if d[i][0]==d[i][1]:
		if d[i+1][0]==d[i+1][1]:
			if d[i+2][0]==d[i+2][1]:
				print("Yes")
				exit()

print("No")

Solution (Python):
import sys

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



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")

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]

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

count = 0
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]:
        count = 1
        break
    else:
        pass

if count == 0:
    print('No')
elif count == 1:
    print('Yes')

Solution (Python):
import sys
def cal():
    if D11==D12 and D21==D22 and D31==D32:
        print('Yes')
        sys.exit()

N=int(input())
D11,D12=map(int,input().split())
D21,D22=map(int,input().split())
D31,D32=map(int,input().split())
cal()
for _ in range(0,N-3):
    D11=D21
    D12=D22
    D21=D31
    D22=D32
    D31,D32=map(int,input().split())
    cal()
print('No')

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

cnt=0
ans="No"
for i in range(n):
    a,b=lst[i]
    
    if a==b:
        cnt+=1
    else:
        cnt=0
    if cnt==3:
        
        ans="Yes"
        break

print(ans)

Solution (Python):
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][0]==l[k][1] and l[k+1][0]==l[k+1][1] and l[k+2][0]==l[k+2][1]:
    j+=1
    break
if j==1:
  print('Yes')
else:
  print('No')

Solution (Python):
def main():
    D = []
    n = int(input())
    for i in range(n):
        d = list(map(int, input().split()))
        D.append(d)
        
    for i in range(n):
        flag = 0
        for j in range(n-i):
            if D[i+j][0] == D[i+j][1]:
                flag += 1
            else:
                break
        if flag == 3:
            print('Yes')
            exit()
    
    print('No')


    
if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

zoro_cnt = 0
for _ in range(N):
  D1, D2 = map(int,input().split())
  if D1 == D2:
    zoro_cnt += 1
    if zoro_cnt == 3:
      break
  else:
    zoro_cnt = 0
    
if zoro_cnt == 3:
  print('Yes')
else:
  print('No')

Solution (Python):
n=int(input())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
a=0
for i in range(n-2):
    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")
                a+=1 
                break

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

Solution (Python):

import sys

YES = "Yes"  
NO = "No"  


def solve(N: int, D: "List[List[int]]"):

    flag=0

    for i in range(N):

        if D[i][0] == D[i][1]:
            flag += 1
            if flag >= 3:
                print(YES)
                return
        else:
            flag=0
        
    print(NO)


    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    D = [[int(next(tokens)) for _ in range(2)] for _ in range(N)]  
    solve(N, D)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())

dice = []
for i in range(n):
    dice.append(list(map(lambda x: int(x), input().split(" "))))

if n < 3:
    print("No")
    exit(0)

for i in range(n-2):
    if dice[i][0] == dice[i][1] and dice[i+1][0] == dice[i+1][1] and dice[i+2][0] == dice[i+2][1]:
        print("Yes")
        exit(0)

print("No")

Solution (Python):
N = int(input())
D = [input().split() for i in range(N)]

count = 0

for i in range(N):
    x, y = D[i]
    if x == y:
        count += 1
        if count >= 3:
            print('Yes')
            exit()
    else:
        count = 0

print('No')

Solution (Python):
N=int(input())
DD=[]
t=0

for _ in range(N):
    D=list(map(int,input().split()))
    DD.append(D)

for i in range(N-2):
    if (DD[i][0]-DD[i][1])**2+(DD[i+1][0]-DD[i+1][1])**2+(DD[i+2][0]-DD[i+2][1])**2==0:
        t=1
        break
    i+=1
if t==1:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
count = 0
for _ in range(N):
    d1, d2 = input().split()
    if d1 == d2:
        count += 1
        if count >= 3:
            break
    else:
        count = 0

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

Solution (Python):
n = int(input())
count = 0
check = 0
for i in range(1,n+1):
    a, b = map(int, input().split())
    if a == b:
        count+=1
        if count >= 3:
            check = 1
    elif a != b:
        count = 0

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

Solution (Python):

N = int(input())
D = []
for i in range(N):
    D.append(input())
yes = 0
yes3 = 0
for i in range(N):
    D1, D2 = map(int, D[i].split(' '))

    
    if D1 == D2:
        yes += 1
        if yes >= 3:
            yes3 = 1
    else:
        yes = 0
if yes3 == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
import math
from fractions import Fraction as frac

MOD = 1e9 + 7

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

def solve(case_no):
    n = int(input())
    cnt=0
    for i in range(n):
    	a,b = map(int,input().split())
    	if a==b:
    		cnt += 1
    		if cnt == 3:
    			print("Yes")
    			exit()
    	else:
    		cnt=0
    print("No")
    	

t = 1

for i in range(1, t + 1):
    solve(i)

Solution (Python):
n = int(input())
count = 0
f = False
for i in range(n):
  d1, d2 = [int(x) for x in input().split()]
  if d1 == d2:
    count += 1
  else:
    count = 0
  if count == 3:
    f = True
if f:
  print("Yes")
else :
  print("No")

Solution (Python):
N = int(input())
x = []
count = 0
for i in range(N):
    D1,D2 = map(int,input().split())
    t = [D1,D2]
    x.append(t)
i = 0
while i <= N-3:
    if i > N-3:
        break
    elif x[i][0] == x[i][1] and x[i+1][0] == x[i+1][1] and x[i+2][0] == x[i+2][1]:
        t = 'Yes'
        break
    else:
        t = 'No'
    i +=1
print(t)

Solution (Python):
n=int(input())
string_list=[input() for i in range(n)]
list = [x.split() for x in string_list]

count = 0
for s in list:
    if s[0] == s[1]:
        count+=1
        if count == 3:
            break
    else:
        count = 0

if count == 3:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a_lst = []
b_lst = []
clear = 0
cnt = 0
for i in range(n):
  a, b = map(int, input().split())
  a_lst.append(a)
  b_lst.append(b)

for a, b in zip(a_lst, b_lst):
  if a == b:
    cnt += 1
  else:
    cnt = 0

  if cnt == 3:
    clear = 1
    break

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

Solution (Python):
n = int(input())
a = []
for i in range(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')

Solution (Python):

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

def main():
    for i in range(n-2):
        
        if d1[i] == d2[i] and d1[i+1] == d2[i+1] and d1[i+2] == d2[i+2]:
            print('Yes')
            exit()
    print('No')

if __name__ == '__main__':
    main()

Solution (Python):
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
        cnt = 0
    if cnt == 3 and renzoku == 3:
        print('Yes')
        break
else:
    print('No')

Solution (Python):
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')
    exit()
print('No')

Solution (Python):
n=int(input())
li = [list(map(int,input().split())) for i in range(n)]

f = 0

for i in range(n):
    if li[i][0] == li[i][1]:
        f = f+1
        if f == 3:
            print("Yes")
            break
    else:
        f = 0

if f != 3:
    print("No")

Solution (Python):

    
    


import sys, os.path

if(os.path.exists('input.txt')):
    sys.stdin = open('input.txt',"r")
    

sys.setrecursionlimit(10 ** 5)

def mod(): return 10**9+7
def i(): return sys.stdin.readline().strip()
def ii(): return int(sys.stdin.readline())
def li(): return list(sys.stdin.readline().strip())
def mii(): return map(int, sys.stdin.readline().split())
def lii(): return list(map(int, sys.stdin.readline().strip().split()))



def solve():
    a=ii() ; p = q = 0 ;
    for _ in range(a):
        a,b=mii()
        if a==b:
            p+=1
            if p>q:
                q=p
        else: 
            p=0
    if q>=3: print('Yes')
    else: print('No')

for _ in range(1):
    solve()

Solution (Python):
def main():
    n = int(input())
    count = 0
    for i in range(n):
        d1, d2 = map(int, input().split())
        if d1 == d2:
            count += 1
            if count == 3:
                return "Yes"
        else:
            count = 0
    return "No"


if __name__ == "__main__":
    print(main())

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