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):
def main():
    N = int(input())

    max_zoro = 0
    current_zoro = 0

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

        if D1 == D2:
            current_zoro += 1
        else:
            current_zoro = 0
        max_zoro = max(max_zoro, current_zoro)

    if 3 <= max_zoro:
        print("Yes")
    else:
        print("No")


main()

Solution (Python):
n=int(input())
a=[[int(i) for i in input().split()] for _ in range(n)]
c=0
for x in a:
     if x[0]==x[1]:
          c+=1
          if c>=3:print("Yes");exit()
     else:c=0
print("No")

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

zorome_max = 0
zorome_now = 0
for i in range(n):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    zorome_now += 1
  else:
    zorome_now = 0
  zorome_max = max(zorome_max, zorome_now)

print("Yes" if zorome_max >= 3 else "No")

Solution (Python):



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

n = int(input())
cnt = 0
for i in range(n):
    b,c = mp()
    if b==c:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    else:
        cnt = 0
print("No")

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

count = 0
no = True

for _ in range(N):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    count += 1
  else:
    count = 0
  
  if count == 3:
    print("Yes")
    no = False
    break

if no:
  print("No")

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

ans = 'No'
count = 0
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
    else:
        count = 0
    if count == 3:
        ans = 'Yes'
        break

print(ans)

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

now = 0

ans = "No"

for i in range(N):
  D1, D2 = map(int, input().split())
  if D1 == D2: now += 1
  else: now = 0
  if now == 3:
    ans = "Yes"
    break

print(ans)

Solution (Python):

import sys
import bisect as bi
import math
from collections import defaultdict as dd
import heapq
import itertools

input=sys.stdin.readline
import random



mod=10**9+7
def cin():
    return map(int,sin().split())
def ain():            
    return list(map(int,sin().split()))
def sin():
    return input()
def inin():
    return int(input())

    
for _ in range(1):
    n=inin();cont=0;f=0
    for i in range(n):
        a,b=cin()
        if(a==b):
            cont+=1
        else:
            cont=0
        if(cont==3):
            f=1
    if(f):print("Yes")
    else:print("No")

Solution (Python):
i = int(input())
renzoku_double_count = 0
r = "No"
for i in range(i):
  inp = input().split(" ")
  dice0= int(inp[0])
  dice1= int(inp[1])
  if dice0 == dice1:
    renzoku_double_count += 1
  else:
    renzoku_double_count = 0
  if renzoku_double_count == 3:
    r  = "Yes"
    break
print(r)

Solution (Python):
Row = int(input())
List = []
for i in range (Row):
  List.append(list(map(int, input().split())))
k = 0
flag = False
for i in range(Row):
  if List[i][0] == List[i][1]:
    k += 1
  else:
    k = 0
  if k == 3:
    flag = True
    break
if flag:
  print("Yes")
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):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7





N = getN()
que = [getList() for i in range(N)]

cnt = 0
ans = 0

for a, b in que:
    if a == b:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0

ans = max(ans, cnt)

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

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

flag = 0
count = 0
for i in range(n):
  sai = input().split(" ")
  
  if int(sai[0]) == int(sai[1]):
    count += 1
  else:
    count = 0
  
  if count == 3:
    flag = 1

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

Solution (Python):
import sys
input = sys.stdin.readline




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

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


now=d[0][0]
for i in range(n-2):
    if d[i][1]==d[i][0] and d[i+1][1]==d[1+i][0] and d[i+2][1]==d[2+i][0]:
        print("Yes")
        sys.exit()
print("No")

Solution (Python):
N = int(input())
count = 0
for _ 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')

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

print("No")

Solution (Python):
import sys
input = sys.stdin.readline

n = int(input())

cnt = 0
for _ in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    
    if cnt == 3:
        break

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

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

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

Solution (Python):
n=int(input())
d=[[0] *2 for i in range(n)]
cnt=0
c=0

for i in range(n):
  a,b=map(int,input().split())
  if a==b:
    cnt+=1
  else:
    cnt=0
  if cnt==3:
    c=1
if c==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))
ans = "No"
for i in range(N-2):
    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"
print(ans)

Solution (Python):
n = int(input())
zoro_flag = "000"
ans = False
for i in range(n):
    zoro_flag = zoro_flag[1:]
    d1, d2 = input().split()
    if d1 == d2:
        zoro_flag += "1"
        if zoro_flag == "111":
            ans = True
    else:
        zoro_flag += "0"
print("Yes") if ans else print("No")

Solution (Python):
N = int(input())
count = 0
flag = 0
for i in range(N):
  D_1, D_2 = map(int,input().split())
  if D_1 == D_2:
    count += 1
  else:
    count = 0
  if count == 3:
    flag = 1
    break
if flag:
  print('Yes')
else:
  print('No')

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

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

count = 0
flag = False
for i in range(N):
    D = list(map(int, input().split()))
    if (flag):
        if (D[0] == D[1]):
            count += 1
        else:
            flag = False
            count = 0
    else:
        if (D[0] == D[1]):
            flag = True
            count = 1
    if (count == 3):
        print("Yes")
        exit()

print("No")

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

count = 0
judge = False
for i in range(n):
  d1, d2 = input().split()
  if d1 == d2:
    count += 1
  else:
    count = 0
  if count >=3:
    judge = True

if judge:
  print('Yes')
else:
  print('No')

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

Solution (Python):

printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7


def ddprint(x):
  if DBG:
    print(x)

n = inn()
x = 0
for i in range(n):
    d,e = inm()
    if d==e:
        x += 1
        if x==3:
            print('Yes')
            exit()
    else:
        x = 0
print('No')

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

print("No")

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

ans = 'No'
count = 0
for _ in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
    else:
        count = 0

    if count == 3:
        ans = 'Yes'

print(ans)

Solution (Python):
n = int(input())
j = ''
for _ in range(n):
    a, b = map(int, input().split())
    if a == b:
        j += 't'
    else:
        j += 'f'

print('Yes' if 'ttt' in j else 'No')

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

class ABC(object):

    def __init__(self):
        pass


    def main(self):
        n = int(input())
        dd = [[int(_) for _ in input().split()] for i in range(n)]

        cnt = 0
        for d1, d2 in dd:
            if d1 == d2:
                cnt += 1
            else:
                cnt = 0

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

        return


if __name__ == "__main__":
    obj = ABC()
    obj.main()
    sys.exit(0)

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

Solution (Python):
def li():
    return [int(x) for x in input().split()]


N = int(input())
D = [li() for _ in range(N)]

maxzoro = 0
zoro = 0

for i in range(len(D)):
    a, b = D[i][0], D[i][1]
    if a == b:
        zoro += 1
        maxzoro = max(maxzoro, zoro)
    else:
        zoro = 0

print('Yes' if maxzoro >= 3 else 'No')

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

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

Solution (Python):
N = int(input())
count = 0
flg = False
for i in range(N):
    
    d1,d2 = map(int,input().split())
    if d1 == d2:
        count += 1
        if count ==3:
            flg = True
    else:
        count = 0
if flg:
    print("Yes")
else:
    print("No")

Solution (Python):
def main():
    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')
                return
        else:
            count = 0
    else:
        print('No')

        
if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
ans = 0
max_ans = 0
cont_flg = 0
for _ in range(N):
  D = list(map(int, input().split()))
  if D[0] == D[1]:
    ans += 1
    max_ans = max(max_ans, ans)
  if D[0] != D[1]:
    cont_flg = 1
    ans = 0
if max_ans >= 3:
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
z = 0
for n in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        z += 1
    else:
        z = 0
    if z == 3:
        print("Yes")
        exit()
print("No")

Solution (Python):




n = int(input())
ans = 'No'
cnt = 0

for i in range(n):
    d1, d2 = map(int,input().split())
    if d1 == d2:
        cnt = cnt + 1
        if cnt >= 3:
            ans = 'Yes'
            break
    else:
        cnt = 0


print(ans)

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

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

Solution (Python):
N = int(input())
flags = []
for _ in range(N):
    d1, d2 = map(int, input().split())
    flags.append(d1 == d2)

for i in range(N - 2):
    if flags[i] and flags[i + 1] and flags[i + 2]:
        print('Yes')
        exit()
print('No')

Solution (Python):
n = int(input())
li = [0]*n
for i in range(n):
    d1,d2 = map(int,input().split())
    if d1==d2:
        li[i] = 1
lii = [0]*n
lii[0]=li[0]
for i in range(n-1):
    if li[i+1]==1:
        lii[i+1]=lii[i]+li[i+1]
    else:
        lii[i+1]=0

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

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

cnt = 0
flag = False
for i in range(n):
    d1, d2 = list(map(int, input().split()))
    if (d1 == d2):
        cnt += 1
    else:
        cnt = 0
    
    if (cnt >=3):
        flag = True

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

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

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

print('No')

Solution (Python):
N = int(input())
n = 0
for i in range(N):
  L = list(map(int, input().split()))
  if L[0] == L[1]:
    n += 1
    if n == 3:
      print('Yes')
      break
  else:
    n = 0
else:
  print('No')

Solution (Python):
count=0
flag=False
N=int(input())
for _ in range(N):
    d1,d2=map(int,input().split())
    if d1==d2:
        count+=1
    else:
        count=0
    if count==3:
        flag=True
print('Yes' if flag else 'No')

Solution (Python):
import sys

n = int(input())

dice = []

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

c = 0

for i in range(n):
    if dice[i][0] == dice[i][1]:
        c += 1
    else:
        c = 0
    if c == 3:
        print('Yes')
        sys.exit()

print('No')

Solution (Python):
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')
            exit()
    else:
        count = 0

print('No')

Solution (Python):
N = int(input())
cou = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    if(d1==d2):
        cou += 1
    else:
        cou = 0
    if(cou >= 3):
        print("Yes")
        exit()
print("No")

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

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

zoro = 0
m = 0
for i in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        zoro += 1
        m = max(zoro, m)
    else:
        zoro = 0

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

Solution (Python):
n = int(input())
a = []
for i in range(n):
  d1,d2 = map(int,input().split())
  a.append((d1,d2))
ok = False
for i in range(n-2):
  x,y,z = a[i],a[i+1],a[i+2]
  if x[0]==x[1] and y[0]==y[1] and z[0]==z[1]:
    ok = True
    break
print("Yes" if ok else "No")

Solution (Python):
from sys import stdin

def main():

    input = stdin.readline

    N = int(input())

    count = 0
    flag = False
    for _ in range(N):
        d1,d2 = map(int,input().split())

        if d1 == d2:
            count += 1
        else:
            count = 0
        
        if count >= 3:
            flag = True



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


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
n = int(input())
a = []
for i in range(n):
  x, y = map(int, input().split())
  if x == y:
    a.append(1)
  else:
    a.append(0)
  if len(a) > 2:
    if a[-1] + a[-2] + a[-3] == 3:
      print('Yes')
      exit()
print('No')

Solution (Python):
N = int(input())
ans = 0
renzoku = 0
for _ in range(N):
    D1,D2 = map(int,input().split( ))
    if D1 == D2:
        renzoku += 1
    else:
        renzoku = 0
    if renzoku == 3:
        ans += 1
if ans > 0:
    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 - 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]:
        print("Yes")
        exit(0)

print("No")

Solution (Python):
n=int(input())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
f=0
c=0
for i in range(n):
    if(l[i][0]==l[i][1]):
        c+=1
        if(c==3):
            f=1
            break
    else:
        c=0
if(f==1):
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
s=int(input())
flag=0
z=0
for i in range(s):
    p= list(map(int, input().split()))
    if p[0]==p[1]:
        z+=1
        if z==3:
            flag=1
    else:
        z=0
if flag:
    print("Yes")
else:
    print("No")

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

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

renzoku=0
ans=0
for i in xy:
    if i[0]==i[1]:
        renzoku+=1
        if renzoku ==3:
            ans=1
            break
    else :
        renzoku=0
if ans==1:
    print("Yes")
else :
    print("No")

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

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

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

Solution (Python):
N=int(input())
a=[0]*N
b=[0]*N
for i in range(N):
    a[i],b[i]=map(int,input().split())
count=0
for i in range(N):
    if(a[i]==b[i]):
        count=count+1
        if(count==3):
            print('Yes')
            exit()
    else:
        count=0
print('No')

Solution (Python):
'''بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ'''

gi = lambda : list(map(int,input().split()))
cnt = 0
for _ in range(gi()[0]):
  x, y = gi()
  if x == y:
    cnt += 1
  else:
    cnt = 0
  if cnt == 3:
    print("Yes")
    exit()
print("No")

Solution (Python):
N = int(input())
counter = 0
flag = False

for i in range(N):
    l = input().split(" ")
    if l[0] == l[1]:
        counter += 1
    else:
        counter = 0
    if counter == 3:
        flag = True

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

Solution (Python):
N = int(input())
D = []
cont_count = 0

for _ in range(N):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    cont_count += 1
    if cont_count == 3:
      print('Yes')
      exit()
  else:
    cont_count = 0

print('No')

Solution (Python):
N=int(input())
D=[]
for i in range(N):
    S=list(map(int,input().split()))
    S=len(set(S))
    D.append(S)
for i in range(len(D)-2):
    if D[i]==D[i+1]==D[i+2] and D[i]==1:
        print("Yes")
        exit()
print("No")

Solution (Python):
def abc179b():
    n = int(input())
    cnt = 0
    flg = False
    for _ in range(n):
        d1, d2 = map(int, input().split())
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
        if cnt == 3:
            flg = True
    if flg:
        print('Yes')
    else:
        print('No')
abc179b()

Solution (Python):
count = 0
ans = False
for __ in range(int(input())):
    a, b = map(int, input().split())
    if a == b:
        count += 1
    else:
        count = 0
    if count == 3:
        ans = True
        break

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

Solution (Python):


from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2, log10, pi
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key
from bisect import bisect_left


INF=1001001001
__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


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

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

def bindex(a,x):
    i = bisect_left(a,x)
    if i != len(a) and a[i] == x:
        return i
    return None

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __radd__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x + self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x + self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rsub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x - self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x - self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rmul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __rtruediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((other.__x * self.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((other.__x * self.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")

    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __rpow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(other.__x, self.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(other.__x, self.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")

    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x
    def __str__(self):
        return str(self.__x)



if __name__ == '__main__':
    N = intinput()

    indatas = []
    for _ in range(N):
        indatas.append(tuple(list(mulinputs())))
    cnt = 0
    for d in indatas:
        d1, d2 = d[0], d[1]
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
        if cnt == 3:
            print('Yes')
            exit()
    if cnt == 3:
        print('Yes')
        exit()
    print('No')

Solution (Python):
N = int(input())
count = 0
flag = False
for i in range(N):
    D1, D2 = map(int, input().split())

    if D1 == D2:
        count += 1
    else:
        count = 0
    if count >= 3:
        flag = True

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

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

Solution (Python):
n = int(input())
a = 0; b = 0
for i in range(n):
    x, y = map(int, input().split())
    if x == y: b += 1; a = max(a, b)
    else: b = 0
print("Yes") if a > 2 else print("No")

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

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

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

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

    if a == b:
        count += 1
    else:
        count = 0

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

print('No')

Solution (Python):
it = lambda: list(map(int, input().strip().split()))


def solve():
    n = int(input())
    ok = False
    cnt = 0
    for _ in range(n):
        a, b = it()
        if a == b:
            cnt += 1
            if cnt == 3:
                ok = True
        else:
            cnt = 0
    return 'Yes' if ok else 'No'

if __name__ == '__main__':
    print(solve())

Solution (Python):
import sys

input = sys.stdin.readline

N = int(input())
tmp = 0
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        tmp += 1
        if tmp == 3:
            print("Yes")
            sys.exit()
    else:
        tmp = 0

print("No")

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

num = 0
for d1, d2 in Dss:
    if d1 == d2:
        num += 1
        if num >= 3:
            print('Yes')
            break
    else:
        num = 0
else:
    print('No')

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

m = 0
now = 0
for i in range(n):
    x,y = map(int, input().split())
    if x == y:
        now += 1
        m = max(m, now)
    else:
        now = 0

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

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

Solution (Python):
import sys
import math
import itertools
import collections
from collections import deque
from collections import defaultdict

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD2 = 998244353
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    AB = [NLI() for _ in range(N)]
    
    for n in range(N-2):
        if AB[n][0] == AB[n][1]:
            if AB[n+1][0] == AB[n+1][1]:
                if AB[n+2][0] == AB[n+2][1]:
                    print("Yes")
                    sys.exit()
    print("No")





if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
cnt = 0
ans = False
for i in range(n):
    if d[i][0] == d[i][1]:
        cnt += 1
        if cnt >= 3:
            ans = True
            print('Yes')
            exit()
    else:
        cnt = 0
print('No')

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