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):
_int = int(input())
_list = []
_bool = 0
for i in range(_int):
  _list_element = list(map(int, input().split()))
  _list.append(_list_element[0])
  _list.append(_list_element[1])
  

for i in range(1, 2*_int - 4, 2):
  
  if _list[i] == _list[i -1]:
    if _list[i + 2] == _list[i + 1]:
      if _list[i + 4] == _list[i + 3]:
        _bool += 1

if _bool >= 1:
  print("Yes")
else:
  print("No")

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

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


check_list=[]

for i in range(N):
    check_list.append(l[i][0]==l[i][1])

a=0

for j in range(N-2):
    if check_list[j]==True and check_list[j] == check_list[j+1] and check_list[j]==check_list[j+2]:
            print('Yes')
            a=1
            break
    else:
        continue

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

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

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

match_num=0

for i in range(n):
  d1,d2 = map(int,input().split())
  if(d1 == d2):
    match_num += 1
  else:
    match_num = 0
  if(match_num == 3):
    print("Yes")
    exit()

print("No")

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

d1=[]
d2=[]

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

    d1.append(D1)
    d2.append(D2)

for i in range(len(d1)):
    if d1[i]==d2[i]:
        cont+=1
    else:
        cont=0

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

Solution (Python):
n = int(input())
l = []

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

x = 0
z = ""

while n > x:
    y = l[x*2] - l[x*2+1]
    z = z + str(y)
    x+=1

if "000" in z:
    print("Yes")
else:
    print("No")

Solution (Python):


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


def input_array():
    return input().split()


def answer():
    n = input_int()
    same_counter = 0
    for i in range(n):
        d1, d2 = input_array()
        if d1 == d2:
            same_counter += 1
            if same_counter >= 3:
                print('Yes')
                return
        else:
            same_counter = 0
    print('No')


answer()

Solution (Python):
n = int(input())
counter = 0
coutlist = []
value = False
for i in range(n):
    a,b = map(int, input().split())
    if i == 0:
        if a == b:
            counter+=1
            coutlist.append(counter)
            value = True
    else:
        if a == b and value == True:
            counter+=1
            value = True
            coutlist.append(counter)
        elif a == b and value == False:
            counter = 1
            value = True
            coutlist.append(counter)
        else:
            counter = 0
            value = False
            coutlist.append(counter)

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

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

Solution (Python):
n = int(input())
ans = 0
f1, f2, f3 = 0, 0, 0
for i in range(n):
    f3 = f2
    f2 = f1
    d1, d2 = map(int, input().split())
    f1 = d1 == d2
    if f1 == f2 == f3 == 1:
        ans = 1
print('Yes' if ans else '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:
        if count >= 3:
            print("Yes")
            exit()
        count = 0
if count >= 3:
    print("Yes")
else:
    print("No")

Solution (Python):
n = int(input())
a = []
for i in range(n):
	a.append(input().split())
for i in range(len(a)-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]):
		print("Yes")
		exit()
print("No")

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

count = 0
ok = 0

for i in range(N):
    x, y = map(int, input().split())
    if x == y:
        count += 1
    else:
        count = 0
    if count == 3:
        ok = 1

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

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

d = [ list(map(int,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")
        break
else:
    print("No")

Solution (Python):
N = int(input())
count = 0
c = 0
for i in range(N):
    d1,d2 = input().split()
    if d1==d2:
        count+=1
        if count==3:
            c =1

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

Solution (Python):
N = int(input())
z,w = [],[]
K = 0
for i in range(N):
  x,y = map(int,input().split())
  z.append(x)
  w.append(y)
for j in range(N-2):
  if z[j] == w[j] and z[j+1] == w[j+1] and z[j+2] == w[j+2]:
    K += 1

if K >= 1:
  print("Yes")
else:
  print("No")

Solution (Python):
n =int(input())
count = 0
judge = 0
for i in range(n):
    nums = [int(e) for e in input().split()]
    if nums[0] == nums[1]:
        count += 1
        if count >= 3:
            judge = 1
    else:
        count = 0

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

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

for i in range(N):
  s[i], t[i] = map(int, input().split())

for n in range(N):
  if s[n]==t[n] and s[n+1]==t[n+1] and s[n+2]==t[n+2]:
    print('Yes')
    break
  elif n == N - 3:
    print('No')
    break
  else:
    continue

Solution (Python):
def calc():
	n = int(input())
	c = 0

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

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

def main() :
	calc()

if __name__ == '__main__' :
	main()

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

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

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

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

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

AN = (''.join(G))

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

Solution (Python):
n=int(input())
res=0
xy = [map(int, input().split()) for i in range(n)]
x, y = [list(i) for i in zip(*xy)]
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]:
        res+=1
if res>0:
    print("Yes")
else:
    print("No")

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

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

Solution (Python):
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
total = 0
for j in range(2,N):
    if x[j-2] == y[j-2] and x[j-1] == y[j-1] and x[j] == y[j]:
        total += 1
if total == 0:
    print('No')
else:
    print('Yes')

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

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

Solution (Python):
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase
from collections import deque
from math import *

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def solve():
    n = int(input())
    count = 0
    lst = []
    for j in range(n):
        a, b = map(int, input().split())
        lst.append((a,b))
    for i in range(n-2):
        if lst[i][0] == lst[i][1]:
            if lst[i+1][0] == lst[i+1][1] and lst[i+2][0] == lst[i+2][1]:
                print('Yes')
                break
    else:
        print('No')
            
        
           
def main():
    
    
    
    
        solve()
        


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


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

T = 1
for t in range(1,T + 1):
	n = int(input())
	count = 0; ans = 0
	for i in range(1,n + 1):
		x,y = map(int,input().split())
		if x == y:
			count += 1
		else:
			ans = max(ans,count)
			count = 0
	ans = max(ans,count)
	print("Yes" if ans >= 3 else "No")

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

for i in range(N - 2):
    if Dx[i] == Dy[i] and Dx[i + 1] == Dy[i + 1] and Dx[i + 2] == Dy[i + 2]:
        count = 1
if count >= 1:
    print("Yes")
else:
    print("No")

Solution (Python):
n=int(input())
score=[]
point=0
for i in range(n):
  d=input().split()
  if d[0]==d[1]:
    point+=1
    score.append(point)
  else:
    point=0
    score.append(point)

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

Solution (Python):
N=int(input())
count=0
ans=0
for _ in range(N):
    a, b = map(int, input().split())
    if a!=b:
        count=0
    else:
        count+=1
        if count==3:
            ans=count
if ans==3:
    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
        if cnt >=3:
            print("Yes")
            exit()
    else:
        cnt = 0        
print("No")

Solution (Python):
from collections import deque

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

    deq = deque(D)

    count = 0

    while deq:
        pts = deq.popleft()
        if pts[0] == pts[1]:
            count += 1
        else:
            count = 0
        if count >= 3:
            print("Yes")
            return

    print("No")

main()

Solution (Python):
num = int(input())
counter = 3

for n in range(num):
  
  x, y = map(int, input().split())
  if x == y:
    counter -=1
  else:
    counter = 3
  
  if counter <= 0:
    print('Yes')
    break

if counter > 0:
  print('No')

Solution (Python):
N = int(input())
x=[0]*N
y=[0]*N
L=[0]*N

flag = "No"

if N <3:
  flag = "No"

else:

  for i in range(N):
      x[i],y[i] = map(int, input().split())

  for i in range(N):
    if x[i]==y[i]:
      L[i]=1

  

  for i in range (N-2):
    
    if L[i] == L[i+1] == L[i+2] == 1:
      flag = "Yes"



print(flag)

Solution (Python):
def main():
    n = int(input())
    D = [list(map(int, input().split())) for i in range(n)]
    for i in range(2, n):
        if D[i-2][0] == D[i-2][1]:
            if D[i-1][0] == D[i-1][1]:
                if D[i][0] == D[i][1]:
                    print('Yes')
                    exit()
    print('No')
if __name__ == '__main__':
    main()

Solution (Python):
import sys

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

for j in range(n-2):
    count = 0
    if d1[j] == d2[j]:
        count += 1
        if d1[j+1] == d2[j+1]:
            count += 1
            if d1[j+2] == d2[j+2]:
                count += 1
                print("Yes")
                sys.exit()

if count < 3:
    print("No")

Solution (Python):
n = int(input())
d1, d2 = [], []
for i in range(n):
    a, b = input().split()
    d1.append(int(a))
    d2.append(int(b))

count = 0
for a, b in zip(d1, d2):
    if a == b:
        count += 1
    else:
        count = 0
    if count == 3:
        print('Yes')
        break

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

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

Solution (Python):
n=int(input())
d12=[map(int, input().split()) for _ in range(n)]
d1,d2= [list(i) for i in zip(*d12)]

count=0
for i in range(n):
    if d1[i]==d2[i]:
        count+=1
    else:
        count=0

    if count==3:
        print('Yes')
        break

else:
    print('No')

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

s=0
flag=False
for k in range(N):
      if x[k]==y[k]:
         s=s+1
         if s==3:
          flag=True
          break
      else:
         s=0
 
if flag==True:
  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)]
tmp = 1
ans = [1]
for i in range(N):
    if i == N - 1:
        break
    else:
        if x[i] == y[i] and x[i+1] == y[i+1]:
            tmp += 1
        else:
            tmp = 1
        ans.append(tmp)
if max(ans) >= 3:
    print("Yes")
else:
    print('No')

Solution (Python):
n = int(input())
a = [input().split(" ") for i in range(n)]
num = 0
nummax = 0
for i in range(n):
  if int(a[i][0])==int(a[i][1]):
    num+=1
  else:
    if num> nummax:
      nummax = num
    num=0
if num> nummax:
   nummax = num
if nummax>=3:
  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())

A = 0

for i in range(N-2):
    if (D1[i] == D2[i]) & (D1[i+1] == D2[i+1]) & (D1[i+2] == D2[i+2]):
        print("Yes")
        A = 1
        break

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

Solution (Python):
N=int(input())
A=[]
for i in range(N):
  D1,D2=map(int,input().split())
  if D1==D2:
    A.append("1")
  else:
    A.append("0")
    
one="".join(A)
if "111" in one:
  print("Yes")
else:
  print("No")

Solution (Python):


N = int(input())

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

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

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

if cou < 3:
    print('No')

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

Solution (Python):
rolls = []
for _ in range(int(input())):
    a, b = [int(x) for x in input().split()]
    rolls.append([a, b])
has = 0
for i in rolls:
    if i[0] == i[1]:
        has += 1
        
        if has == 3:
            break
    else:
        has = 0
print("Yes" if has == 3 else "No")

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

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

count = 0
a = []

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

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

Solution (Python):

n = int(input())

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

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

Solution (Python):
import sys

MAX_N  = 100

N = int(input())

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

for i in range(3-1,N):
    if x[i-2] == y[i-2]:
        if x[i-1] == y[i-1]:
            if x[i] == y[i]:
                print("Yes")
                sys.exit()  

print("No")

Solution (Python):
n=int(input())
d=[]
ok=False
for i in range(n):
    l=list(map(int,input().split()))
    d.append(l)
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]:
        ok=True
if ok:
    print('Yes')
else:
    print('No')

Solution (Python):
N = int(input())
i=0
cnt = 0
flg = 0

while i < N:
    i += 1
    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")

Solution (Python):

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

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

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

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

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

Solution (Python):
N = int(input())
list1 = []
list2 = []
p = 0
k = 0
for i in range(N):
    a, b = map(int, input().split())
    list1.append(a)
    list2.append(b)
for j in range(N):
    if list1[j] == list2[j]:
        p += 1
    else:
        p = 0
    if p == 3:
        k += 1

if k >= 1:
    print('Yes')
else:
    print('No')

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

n_list = []
for i in range(N):
  if(s[i][0] == s[i][1]):
    n_list.append(1)
  elif(s[i][0] != s[i][1]):
    n_list.append(0)
    
ans = []
for i in range(N - 2):
  if(n_list[i] == 1 and n_list[i + 1] == 1 and n_list[i + 2] == 1):
    ans.append("Yes")
    break
  else:
    ans.append("No")
    
if "Yes" in ans:
  print("Yes")
else:
  print("No")

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

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

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

Solution (Python):
s = int(input())
d = [[int(v) for v in input().split()] for i in range(s)]
ans = False
cnt = 0
for j in range(len(d)):
    if all(elem == d[j][0] for elem in d[j]):
        cnt += 1
    else:
        cnt = 0

    if cnt == 3:
        ans = True
        break
if ans:
    print ("Yes")
else:
    print("No")

Solution (Python):
time = int(input())
xy = [map(int, input().split()) for _ in range(time)]
x, y = [list(i) for i in zip(*xy)]
sum = 0
for i in range(time):
    if x[i] == y[i]:
        sum += 1
        if sum == 3:
            print("Yes")
            break
    else:
        sum = 0

if sum < 3:
    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):
a = input()
N = int(a)
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
flag = 0

for i in range(1,N-1):
    if (x[i-1] == y[i-1]) and (x[i] == y[i]) and (x[i+1] == y[i+1]):
        flag = 1
        break
if flag == 1:
    print('Yes')
else:
    print('No')

Solution (Python):
if __name__ == "__main__":
    N = int(input())
    doublet_count = 0
    is_doublet = False

    for i in range(N):
        d1, d2 = map(int, input().split())
        if d1 == d2:
            doublet_count += 1
        else:
            doublet_count = 0
        if doublet_count == 3:
            is_doublet = True
            break
    
    
    if is_doublet:
        print('Yes')
    else:
        print('No')

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

Solution (Python):
N = int(input())
ans = [False]*3
for i in range(N):
  D1,D2 = input().split()
  ans[i%3] = D1==D2
  if all(ans): break
print("Yes" if all(ans) else "No")

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

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

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

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

mulArr = []
for _ in range(N):
  arr = list(map(int, input().split(" ")))
  mulArr.append(arr)


result = 0
for i in range(0, len(mulArr) - 2):
  
  if mulArr[i][0] == mulArr[i][1] and mulArr[i + 1][0] == mulArr[i + 1][1] and mulArr[i + 2][0] == mulArr[i + 2][1]:
    result += 1


if result != 0:
  print("Yes")
else:
  print("No")

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

for i in range(n):
    al, be = map(int, input().split())
    if al == be:
        count += 1
        if count >= 3:
            print("Yes")
            break
    else:
        count = 0
else:
    print("No") if count < 3 else print("Yes")

Solution (Python):
N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
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]:
        print("Yes")
        exit()

print("No")

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

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

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

an=1
for i in range(n):
    if n > i+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]:
            an=0
            break
    else:
        an=1
if an==0:
    print('Yes')
else:
    print('No')

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

result=[0]

for i in range(n):
    a,b=map(int,input().split())
    if(a!=b):
        result.append(0)
    else:
        result.append(result[-1]+1)

for i in range(1,n+1):
    if(result[i]==3):
        print("Yes")
        break
    if(i==n):
        print("No")

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

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

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

    if D1 == D2:
        D += 1

    elif D1 != D2:
        D = 0

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

Solution (Python):
N = int(input())
l = []
m = []
for i in range(N):
    a,b = map(int,input().split())
    l.append(a)
    m.append(b)
flg = 0
c = 0
for i in range(len(l)):

    if l[i] == m[i]:
        c += 1
        if c==3:
            flg += 1
            
    else:
        c = 0
if flg == 0:
    print("No")
else:
    print("Yes")

Solution (Python):
n=int(input())
xy = [map(int, input().split()) for _ in range(n)]
x, y = [list(i) for i in zip(*xy)]
a=0
for i in range(n):
  if x[i]==y[i]:
    a+=1
    if a==3:
      break
  else:
    a=0
    
if a>=3:
  print("Yes")
else:
  print("No")

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

last = 0
for item in l:
  if last == 0 and item[0] == item[1]:
    last = 1
    continue
  elif last == 1 and item[0] == item[1]:
    last = 2
    continue
  elif last == 2 and item[0] == item[1]:
    last = 3
    break
  else:
    last = 0

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

Solution (Python):

n = int(input())

flag = True
con = 0
for _ in range(n):
    x,y = map(int,input().split())
    if x == y:
        con += 1
    else:
        con = 0

    if con == 3:
        print("Yes")
        flag = False

if flag:
    print("No")

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

a = [0]*n

for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        a[i] = 1
ans = 'No'        
for i in range(n-2):
    if a[i]*a[i+1]*a[i+2] ==1:
        ans = 'Yes'
        
print(ans)

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

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

count = 0
for i in range(n):
    if d_li[i][0] == d_li[i][1]:
        count += 1
    else:
        count = 0
    
    if count == 3:
        msg = "Yes"
        break
    else:
        msg = "No"

print(msg)

Solution (Python):
import sys

n=int(input())

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

c=0
for j in range(0,len(d)-1,2):
        if d[j]==d[j+1]:
                c+=1
                if c==3:
                        print('Yes')
                        sys.exit()
        else:
                c=0
                
print('No')

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

count = 0
max_count = 0
for i in range(n):
    input_elements = input().split()
    if input_elements[0] == input_elements[1]:
        count += 1
    else:
        if max_count < count:
            max_count = count
        count = 0

if max_count < count:
    max_count = count

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

Solution (Python):



def main():
    ans = 0
    for i in range(int(input())):
        n = input()
        if n[0] != n[2]:
            ans = 0
        else:
            if ans == 2:
                ans += 1
                break
            else:
                ans += 1
    if ans == 3:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

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

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]:
        print('Yes')
        break

    elif i == N-3:
        print('No')

    else:
        continue

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 == True:
    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)]
flag = 0
count = 0

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

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

Solution (Python):
N=int(input())
D=list()
for i in range(0,N):
    a,b=map(int,input().split())
    D.append((a,b))
a = ''
for i in range(0,N):
    if D[i][0]==D[i][1]:
        a=a+'1'
    else:
        a=a+'0'
if '111' in a:
    print('Yes')
else:
    print('No')