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):
import numpy as np
n = int(input())
d = np.array([input().split() for i in range(n)])

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

print("No")

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

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

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

for i in range(0,n):
  l[i] = set(l[i])

ans = "No" 
for i in range(0,n-2):
  if len(l[i]) == 1 and len(l[i+1]) == 1 and len(l[i+2]) == 1:
    ans = "Yes"
  
print(ans)

Solution (Python):
import sys
n=int(input())
val=0
for i in range(n):
  o,t=map(int,input().split())
  if o==t:
    val+=1
  else:
    val=0
  if val==3:
    print('Yes')
    sys.exit()
print("No")

Solution (Python):
n=int(input())
c,f=0,0
while(n>0):
  a,b=map(int,input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c>=3):
    f=1
    break
  n-=1
if(f==1 or c>=3):
  print("Yes")
else:
  print("No")

Solution (Python):
N = int(input())
D = []
i = 0
ans_flag = False
while i < N:
    D1, D2 = map(int, input().split())
    if D1 == D2:
        D.append(1)
        if len(D) == 3:
            ans_flag = True
    else:
        D = []
    i += 1

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

Solution (Python):
def die(matrix, n):
	for i in range(n-2):
		if matrix[i][0] == matrix[i][1]:
			if matrix[i+1][0] == matrix[i+1][1]:
				if matrix[i+2][0] == matrix[i+2][1]:
					return("Yes")

	return("No")			



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


print(die(matrix, n))

Solution (Python):
import sys
S = int(input())
xy = [map(int, input().split()) for _ in range(S)]
x, y = [list(i) for i in zip(*xy)]
count = 0

for i in range(S):
  if x[i] == y[i]:
    count += 1
    if count == 3:
      print("Yes")
      sys.exit()
    else:
      pass
  else:
    count = 0
print("No")

Solution (Python):
pairs = []
N = int(input(''))
for i in range(N):
    pair = input('')
    pair = pair.split(' ')
    pairs.append(pair)

cou = 0
for i, lst in enumerate(pairs):
    if cou == 3:
        break
    elif lst[0] == lst[1]:
        cou += 1
    else:
        cou = 0

if cou != 3:
    print('No')
else:
    print('Yes')

Solution (Python):
N=int(input())
D=[list(map(int,input().split())) for i in range(N)]
tf=0
for j in range(N-2):
    if D[j][0]==D[j][1] and D[j+1][0]==D[j+1][1] and D[j+2][0]==D[j+2][1]:
        tf=1
        break

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

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

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from math import gcd
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7

n=I()
flg=[0]*n
for i in range(n):
    d,e=LI()
    if d==e:
        flg[i]=1

for j in range(n-2):
    if flg[j] and flg[j+1] and flg[j+2]:
        print("Yes")
        exit()

print("No")

Solution (Python):
N=int(input())
x=[]
for i in range(N):
    x.append(list(map(int,input().split())))
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]:
        print("Yes")
        break
else:
     print("No")

Solution (Python):
import sys, os, io
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math,datetime,functools,itertools,operator,bisect,fractions
from collections import deque,defaultdict,OrderedDict,Counter
from fractions import Fraction
from decimal import Decimal
    
def main():
    starttime=datetime.datetime.now()
    if(os.path.exists('input.txt')):
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    
    for _ in range(1):
        n=ri()
        c=0
        z=0
        for i in range(n):
            a,b=ria()
            if a==b:
                c+=1
            else:
                c=0
            z=max(z,c)
        if z>=3:
            print('Yes')
        else:
            print('No')
        
        
        
    
    
        
                    
        
    
    endtime=datetime.datetime.now()
    time=(endtime-starttime).total_seconds()*1000
    if(os.path.exists('input.txt')):
        print("Time:",time,"ms")  
    
                
class FastReader(io.IOBase):
    newlines = 0

    def __init__(self, fd, chunk_size=1024 * 8):
        self._fd = fd
        self._chunk_size = chunk_size
        self.buffer = io.BytesIO()

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self, size=-1):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()


class FastWriter(io.IOBase):

    def __init__(self, fd):
        self._fd = fd
        self.buffer = io.BytesIO()
        self.write = self.buffer.write

    def flush(self):
        os.write(self._fd, self.buffer.getvalue())
        self.buffer.truncate(0), self.buffer.seek(0)


class FastStdin(io.IOBase):
    def __init__(self, fd=0):
        self.buffer = FastReader(fd)
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


class FastStdout(io.IOBase):
    def __init__(self, fd=1):
        self.buffer = FastWriter(fd)
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.flush = self.buffer.flush


if __name__ == '__main__':
    sys.stdin = FastStdin()
    sys.stdout = FastStdout()
    main()

Solution (Python):
N = int(input())
D = [input() for i in range(N)]
count = 0
OK = 0
for ite in D:
    
    
    a,b = map(int,ite.split())
    
    if a == b:
        count += 1
        if count >=3:
            OK = 1
            
        
        else:
            pass
    
    else:
        count = 0

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

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

Solution (Python):
N = int(input())
list_N = []
for _ in range(N):
    list_N.append(list(map(int, input().split())))
s = ''
for i in list_N:
    s += str(len(set(i)))

if '111' in s:
    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 in range(n):
  if d[i][0] == d[i][1]:
    count += 1
  else:
    count = 0
  if count == 3:
    break
print("Yes") if count >= 3 else print("No")

Solution (Python):
import sys
pin = sys.stdin.buffer.readline

N = int(pin())
seqcount = 0
ans = 'No'
for i in range(N):
    d1, d2 = map(int, pin().split())
    if d1 == d2 and seqcount <2:
        seqcount += 1
    elif d1 == d2 and seqcount == 2:
        ans = 'Yes'
        break
    else:
        seqcount = 0

print(ans)

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

def M():
  count = 0
  for j in range(N):
    if x[j] == y[j]:
      if j+2 < N:
        if x[j+1] == y[j+1]:
          if x[j+2] == y[j+2]:
            print('Yes')
            return
  print('No')

M()

Solution (Python):
n = int(input())
d1 = []
d2 = []
cnt = 0

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

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]):
        cnt += 1

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

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

count = 0
for i in range(N-2):
  if list_D[N-i-1][0] == list_D[N-i-1][1] and list_D[N-i-2][0] == list_D[N-i-2][1] and list_D[N-i-3][0] == list_D[N-i-3][1]:
    count += 1
if count > 0:
  print('Yes')
else:
  print('No')

Solution (Python):
N=int(input())
say="No"
if(N<3):
    print("No")
else:
    D1=input()
    D2=input()
    t1=(D1[0]==D1[2])
    t2=(D2[0]==D2[2])
    for i in range(N-2):
        Dn=input()
        if(D1[0]==D1[2] and D2[0]==D2[2] and Dn[0]==Dn[2]):
            say="Yes"
        D1,D2=D2,Dn
print(say)

Solution (Python):
Count = 0
Array = []
for i in range(int(input())):
    Dice_1, Dice_2 = map(int, input().split())
    if Dice_1 == Dice_2:
        Array.append(1)
    else:
        Array.append(0)

ans = []
j_1 = 0
for j in range(len(Array)):
    if j_1 == 1 and Array[j] == 1:
        Count = Count + 1
    else:
        Count = 0
    j_1 = Array[j]
    ans.append(Count)
if max(ans) >= 2:
    print('Yes')
else:
    print('No')

Solution (Python):
def i_input(): return int(input())


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


def i_list(): return list(i_map())


def i_row_list(N): return [i_list() for _ in range(N)]


n = i_input()
d = i_row_list(n)
ans = 'No'
cnt = 0
for d1, d2 in d:
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    if cnt > 2:
        ans = 'Yes'
        break

print(ans)

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

Solution (Python):
n = int(input())
d = [input() for i in range(n)]
c = 0
ans = "No"
for i in range(n):
    if d[i][0] == d[i][-1]:
        c += 1
    else:
        c = 0
    if c == 3:
        ans = "Yes"
        break
print(ans)

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

n = int(input())
dice = []

for _ in range(n):
    d_1, d_2 = map(int,input().split())
    dice.append([d_1, d_2])

ans = 0

for i in range(n-2):
    if dice[i][0] == dice[i][1]:
        if dice[i+1][0] == dice[i+1][1] and dice[i+2][0] == dice[i+2][1]:
            ans = 1
            break
        else:
            continue
        break

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

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

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

Solution (Python):
N = int(input())
D = list2 = [[0 for i in range(2)] for j in range(N)]

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

ans = "No"
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]:
                ans = "Yes"
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
  else:
    cnt = 0
  if cnt == 3:
    print('Yes')
    exit()
print('No')

Solution (Python):
n = int(input())
cnt = 0
for k in [[int(n) for n in input().split()] for i in range(n)]:
    if k[0] == k[1]:
        cnt += 1
        if cnt >= 3:
            print('Yes')
            exit()
    else:
        cnt = 0
print('No')

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

ans = 0
zoro = 0

for i in range(n):
    x,y = map(int,input().split())
    if x == y:
        zoro = zoro + 1
        if ans < zoro:
            ans = zoro
    else:
        if ans < zoro:
            ans = zoro
            zoro = 0
        else:
            zoro = 0

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

Solution (Python):
n = int(input())
d = []
for i in range(n):
  t = [int(x) for x in input().split()]
  d.append(t)

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

print('No')

Solution (Python):


N = int(input())

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


flag = 0
cont = 0
for i in l:
    if(i[0]==i[1]):
        flag = 1
        cont = cont + 1
        
        if (cont>=3):
            break
    else:
        cont = 0
        flag =0



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

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

for i in range(0, N-2, 1):
  if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
    print("Yes")
    cnt_cons += 1
    exit()
if cnt_cons == 0:
  print("No")

Solution (Python):
import numpy as np

n=int(input())

a=np.zeros([n,2])

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



ans=0
for j in range(n-2):
    
    
    if a[j][0]==a[j][1] :
        a1=0
       
        if a[j+1][0]==a[j+1][1]:
            a2=0
           
            if a[j+2][0]==a[j+2][1] :
                a3=0
                
                if a1==0 and a2==0 and a3==0 :
                    ans=ans+1
                   
    a1=0
    a2=0
    a3=0


if ans>0 :
    print("Yes")
if ans==0 :
    print("No")

Solution (Python):
import sys
n = int(sys.stdin.readline().strip())

cnt_flag = 0
res = False
for idx in range(n):
    this_time_vec = sys.stdin.readline().strip().split(' ')
    d_1 = int(this_time_vec[0])
    d_2 = int(this_time_vec[1])
    if d_1 == d_2:
        if cnt_flag > 0:
            cnt_flag = cnt_flag + 1
            if cnt_flag >= 3:
                res = True
                break
        else:
            cnt_flag = 1
    else:
        cnt_flag = 0
    
if res == True:
    print('Yes')
else:
    print('No')

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


for x in Dl :
    if x[0] == x[1] :
        a+=1

    else :
        if a>= 3 :
            a =3
        else :
            a=0


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

Solution (Python):
def get_pair():
    return map(int, input().split())

cnt = 0
ans = "No"
for idx in range(int(input())):
    D1, D2 = get_pair()
    if D1 == D2:
        cnt += 1
    else:
        cnt = 0

    if cnt >= 3:
        ans = "Yes"
        break
print(ans)

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

cnt = 0
for i in range(1,N+1):
    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())
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(len(z)-2):
  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")

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")
      break
  else:
    count = 0
else:
  print("No")

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

ok = 0
aa = 0
for i in range(N):
    A, B = map(int, input().split())
    if A == B:
        aa += 1
    else:
        aa = aa*0
    if aa == 3:
        ok = 1


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

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

D = [input().split() for _ in range(N)]

count = 0

for i in range(N):
  if(D[i][0]==D[i][1]):
    count+=1
    if(count==3):
      print('Yes')
      sys.exit()
  else:
    count=0
print('No')

Solution (Python):
N = int(input())
D = [[-1,1]]*N
ans = "No"

for n in range(N):
  D[n] = list(map(int, input().split()))
  if D[n][0] == D[n][1]:
    if D[n-1][0] == D[n-1][1]:
      if D[n-2][0] == D[n-2][1]:
        ans = "Yes"
        break
print(ans)

Solution (Python):
n = int(input())
d = []
for j in range(n):
    d.append(list(map(int, input().split())))
    
i = 0
while i < 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")
        break
  i += 1
else:
  print("No")

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

Solution (Python):
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] :
        cnt = True
        break
    else :
        cnt = False
    if i==n-3 :
        break

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

Solution (Python):
n = int(input())
c = 0
for i in range(n):
  d1,d2 = map(int,input().split())
  if d1 == d2:
    c += 1
    if c >= 3:
      print("Yes")
      exit()
  else:
    c = 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)]

Yes = 0
for i in range(N-2):
    if x[i]==y[i] and x[i+1]==y[i+1] and x[i+2]==y[i+2]:
        Yes = 1
        break

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

Solution (Python):
n=int(input())
flag=0
ans=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")

Solution (Python):
N = int(input())
D1 = []
D2 = []
for i in range(N):
    d1,d2 = map(int,input().split())
    D1.append(d1)
    D2.append(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]):
                print("Yes")
                exit()

print("No")

Solution (Python):
import sys

N = int(input())
D1 = [0]*N
D2 = [0]*N
ans = 0
for i in range(N):
  D1,D2 = map(int,input().split())
  if D1 == D2:
    ans += 1
  else:
    ans = 0
  if ans == 3:
    print('Yes')
    sys.exit()
print('No')

Solution (Python):
n = int(input())
d = list(input().split() for i in range(n))

flug=False
count = []
for i in range(n):
  if d[i][0] == d[i][1]:
    count.append(int(i))

for j in range(2, len(count)):
  if count[j-2] == count[j-1] - 1 and count[j-1] == count[j] - 1:
    print("Yes")
    flug = True
    break
if flug == False:
	print("No")

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

is_success = False
flags = []


for i in range(N):
	D_one, D_two = input().split()
	D_one, D_two = int(D_one), int(D_two)
    
	if D_one == D_two:
		flags.append(True)
	else:
		flags.append(False)

	if len(flags) > 3:
		flags.pop(0)

	if all(flags) and len(flags)==3:
		is_success = True

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

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

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

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

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

d = []
for i in range(n):
    d.append(input().split())
active = False
count = 0
for x in d:
    if x[0] == x[1]:
        active = True
        count += 1
    else:
        count = 0
        active = False
    if count >2:
        break

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

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

yes=0
for i in range(n-2):
    if d[i][1]==d[i][0] and d[i+1][1]==d[i+1][0] and d[i+2][1]==d[i+2][0]:
        yes+=1
    else:
        pass

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

Solution (Python):
n = int(input())
ds = []
for i in range(n):
  d_1, d_2 = map(int, input().split())
  ds.append((d_1, d_2))
for j in range(n-2):
  if ds[j][0] == ds[j][1] and ds[j+1][0] == ds[j+1][1] and ds[j+2][0] == ds[j+2][1]:
    print("Yes")
    exit()
print("No")

Solution (Python):
import sys

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

c = 0
for i in range(len(d)):
    if (d[i][0] == d[i][1]):
        c += 1
        if (c >= 3):
          print("Yes")
          sys.exit(0)
    else:
      c = 0
print("No")

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

Solution (Python):
n = int(input())
d=[]
flg = False

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




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] :
        flg = True
        break


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

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

Solution (Python):

n = int(input())
d = []

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

count = 0
answer = "no"
for i in range(n) :
    if d[i][0] == d[i][1] :
        count += 1
        if count > 2 :
            answer = "yes"
    else :
        count = 0
    
if answer == "yes" :
    print("Yes")
else :
    print("No")

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

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

for i in range(n):
    try:
        a = res[i] + res[i+1] + res[i+2]
    except:
        break
    if a == 3:
        flg = True
        break

if flg:
    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)]
b = 0
for a in range(N):
  if x[a] == y[a]:
    b += 1
    if b == 3:
      print("Yes")
      break
  else:
    b = 0
if b < 3:
  print("No")

Solution (Python):
n=int(input())
count=0
flag=False
while n:
  a,b=input().split()
  if a==b:
    count+=1
  else:
    count=0
  if count>=3:
    flag=True
  n-=1
if flag:
  print("Yes")
else:
  print("No")

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

Solution (Python):
n = int(input())
d = [input().split(" ") for _ in range(n)]

f = False
for i in range(n-2):
    if d[i][0] == d[i][1] and not f :
        if d[i+1][0] == d[i+1][1] and d[i+2][0] == d[i+2][1]:
            f = True
if f:
    print("Yes")
else:
    print("No")

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

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

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

print("No")

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

for i in range(len(l)-2):
    if (l[i][0]==l[i][1])&(l[i+1][0]==l[i+1][1])&(l[i+2][0]==l[i+2][1]):
        print('Yes')
        break
else:
    print('No')

Solution (Python):
a2=int(input())
a=0
b3=0
for i in range(a2):
    b2,c2=map(str,input().split())
    b=int(b2)
    c=int(c2)
    if b==c:
        a+=1
        if a==3:
            b3=1
            continue
    else:
        a=0
        
if b3>0:
    print('Yes')
if b3==0:
    print('No')

Solution (Python):
count = 0
flag = 0
leng = int(input())
list = []
for i in range(1, leng + 1):
  a,b=input().split()
  list.append((int(a), int(b)))
for j in range(0, leng):
  if(list[j][0] == list[j][1]):
    count = count + 1
  else:
    count = 0
  if(count == 3):
    flag = 1
    
if(flag == 1):
  print("Yes")
else:
  print("No")

Solution (Python):
n=int(input())
k=0
c=0
for i in range(n):
  a,b=map(int,input().split())
  if(a==b):
      k+=1
      if(k>=3):
          c=1
  else:
      k=0

if(c==1):
  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
        if count==3:
            print("Yes")
            exit()
        else:
            pass
            
    else :
        count=0

if count !=3:
    print('No')

Solution (Python):
def resolve():
    throw_count = int(input())
    same_count = int(0)
    answer = "No"
    for _ in range(throw_count):
        throw_1, throw_2 = map(int, input().split())
        if throw_1 == throw_2:
            same_count += 1
            if same_count == 3:
                answer = "Yes"
                break
        else:
            if same_count > 0:
                same_count = 0
    print(answer)
resolve()

Solution (Python):
def foo(l, x):
	return l[x][0]==l[x][1]

n=int(input())
l=[tuple(input().split()) for _ in range(n)]
for i in range(n-2):
	if foo(l, i) and foo(l, i+1) and foo(l, i+2):
		print('Yes')
		quit()
print('No')

Solution (Python):
n = int(input())
count = 0
dices = []
for i in range(n):
    a, b = map(int, input().split())
    dices.append([a, b])
for i in dices:
    if count == 3:
        ans = 'Yes'
        break
    if i[0] == i[1]:
        count += 1
    else :
        count = 0
        pass

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

Solution (Python):
N = int(input())
num = 0
ans = False
for i in range(N):
  D = list(map(int, input().split(' ')))
  if D[0] == D[1]:
    num += 1
    if num >= 3:
      ans = True
  else:
    num = 0

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

Solution (Python):
''' ===============================
    -- @uthor : Kaleab Asfaw
    -- Handle : kaleabasfaw2010
    -- Bio    : High-School Student
    ==============================='''


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file): self._fd = file.fileno(); self.buffer = BytesIO(); self.writable = "x" in file.mode or "r" not in file.mode; self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b: break
            ptr = self.buffer.tell(); self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0; return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE)); self.newlines = b.count(b"\n") + (not b); ptr = self.buffer.tell(); self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1; return self.buffer.readline()
    def flush(self):
        if self.writable: os.write(self._fd, self.buffer.getvalue()); self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file): self.buffer = FastIO(file); self.flush = self.buffer.flush; self.writable = self.buffer.writable; self.write = lambda s: self.buffer.write(s.encode("ascii")); self.read = lambda: self.buffer.read().decode("ascii"); self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout); input = lambda: sys.stdin.readline().rstrip("\r\n")



mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def fact(x, mod=mod):
    ans = 1
    for i in range(1, x+1): ans = (ans * i) % mod
    return ans
def arr2D(n, m, default=0):
    lst = []
    for i in range(n): temp = [default] * m; lst.append(temp)
    return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}

def solve(n, lst):
    for i in range(n-2):
        if lst[i][0] == lst[i][1] and lst[i+1][0] == lst[i+1][1] and lst[i+2][0] == lst[i+2][1]:
            return "Yes"
    return "No"

n = int(input())
lst = []
for i in range(n):
    a, b = list(map(int, input().split()))
    lst.append([a, b])
print(solve(n, lst))

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

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

b=0
c=0
while b<=N-3:
  if a[b][0]==a[b][1] and a[b+1][0]==a[b+1][1] and a[b+2][0]==a[b+2][1]:
     c=c+1
  
  b=b+1

if c>0:
  print('Yes')

else:
  print('No')

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

cnt = 0
flg = 0

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

    if a == b:
        cnt += 1
        if cnt >= 3:
            flg = 1
    else:
        cnt = 0

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