Problem:
 Score : 200 points    Problem Statement Tak performed the following action N times: rolling two dice.
The result of the i -th roll is D_{i,1} and D_{i,2} .  Check if doublets occurred at least three times in a row.
Specifically, check if there exists at lease one i such that D_{i,1}=D_{i,2} , D_{i+1,1}=D_{i+1,2} and D_{i+2,1}=D_{i+2,2} hold.      Constraints  3 \leq N \leq 100  1\leq D_{i,j} \leq 6  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  D_{1,1}  D_{1,2}  \vdots  D_{N,1}  D_{N,2}       Output Print Yes if doublets occurred at least three times in a row. Print No otherwise.        Sample Input 1 5
1 2
6 6
4 4
3 3
3 2      Sample Output 1 Yes  From the second roll to the fourth roll, three doublets occurred in a row.       Sample Input 2 5
1 1
2 2
3 4
5 5
6 6      Sample Output 2 No       Sample Input 3 6
1 1
2 2
3 3
4 4
5 5
6 6      Sample Output 3 Yes

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

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

    if ren == 3:
        print('Yes')
        exit()
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())

cnt=0
ans="No"

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

    if cnt==3:
        ans="Yes"
        break

    if d1[i]!=d2[i]:
        cnt=0
    

print(ans)

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

Solution (Python):
n = int(input())
x = 0
y = 0

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

Solution (Python):
n = int(input())
d = [list(map(int, input().split())) for _ 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())

me = []

count = 0

sw = False

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

    if d1 == d2:
        count += 1
    else:
        count = 0

    if count >= 3:
        sw = True

if sw:
    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:
      break
  else:
    c = 0
if c >= 3:
  print('Yes')
else:
  print('No')

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

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

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

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

Solution (Python):
l = int(input())
c = 0

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

Solution (Python):


n=int(input())



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

Solution (Python):
import sys

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

Solution (Python):
import math
import fractions
import collections
import itertools
N=int(input())
l=[]
for i in range(N):
    x,y=map(int,input().split())
    if x==y:
        l.append(1)
    else:
        l.append(0)
flag=0

for i in range(N-2):
    num=l[i]+l[i+1]+l[i+2]
    
    if num==3:
        flag=1
        break
if flag==1:
    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
    else:
        c = 0
    if c == 3:
        print('Yes')
        exit()
print('No')

Solution (Python):
n = int(input())
a = []
for _ in range(n):
	x,y = map(int,input().split())
	a+=[[x,y]]
ans  = "No"
for i in range(n):
	if i+2<n:
		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())
d = [list(map(int, input().split())) for i in range(n)]
cnt = 0
res = "No"

for i in d:
	if i[0] == i[1]:
		cnt += 1
		if cnt >= 3:
			res = "Yes"
	else:
		cnt = 0
          
print(res)

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

count = 0
for _ in range(N):
  D.append([int(i) for i in input().split()])

for i in D:
  if i[0] == i[1]:
    count += 1
  else:
    count = 0

  if count >= 3:
    break

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

Solution (Python):
n = int(input())
flag = 0
out = False
for j in range(n):
    ins = input().split()
    if(ins[0]==ins[1]):
        flag+=1
        if(flag==3):
            out=True
    else:
        flag = 0
if(out):
    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())

zorome = 0
for i in range(N):
    if D1[i] == D2[i]:
        zorome += 1
        if zorome == 3:
            print("Yes")
            exit()
    else:
        zorome = 0

print("No")

Solution (Python):



import collections
import sys
import copy
import re
import math


def I(): return int(sys.stdin.readline().rstrip())


def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))


def S(): return sys.stdin.readline().rstrip()


def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    DArray = [LI() for _ in range(N)]

    ans = "No"

    for i in range(0, N-2, 1):
        if DArray[i][0] == DArray[i][1]:
            if DArray[i+1][0] == DArray[i+1][1]:
                if DArray[i+2][0] == DArray[i+2][1]:
                    ans = "Yes"
                    break

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
D1 = [0] * N
D2 = [0] * N
for i in range(N):
    D1[i], D2[i] = map(int, input().split())
c = 0
a = 0
    
for d1, d2 in zip(D1, D2):
  if d1 == d2:
    c += 1
  else:
    c = 0
  if c >= 3:
    print("Yes")
    break

if c < 3:
  print("No")

Solution (Python):

import sys
import math
import decimal
import itertools
from itertools import product
from functools import reduce
def input():
    return sys.stdin.readline()[:-1]
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def sort_zip(a:list, b:list):
    z = zip(a, b)
    z = sorted(z)
    a, b = zip(*z)
    a = list(a)
    b = list(b)
    return a, b
def ceil(x):
    return math.ceil(x)
def floor(x):
    return math.floor(x)

def main():
    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 += 1
            if count == 3:
                print('Yes')
                exit()
        else:
            count = 0
    print('No')



if __name__ == '__main__':
    main()

Solution (Python):

n = int(input())
count = 0

for i in range(n):
      DICE,dice = [int(x) for x in input().split()]
      if DICE == dice:
            count += 1
      else:
            count = 0
      
      if count >= 3:
            break

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

Solution (Python):
import sys, re
import math
import numpy as np
from decimal import Decimal
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul	
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd	
from heapq import heappush, heappop

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.maxsize = 10 ** 15
sys.setrecursionlimit(10 ** 9 + 7)
INF = float('inf')
MOD = 10 ** 9 + 7



n = INT()
count = 0
for x in range(0, n):
    a,b = MAP()
    if a == b:
        count += 1
        if count == 3:
            break
    else:
        count = 0
if count == 3:
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
count = 0
is_true = False
for i in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        count += 1
        if count == 3:
            is_true = True
    else:
        count = 0

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

Solution (Python):
n = int(input())
D = [input() for _ in range(n)]
han=0
for a in range(len(D)-2):
    if D[a][0]==D[a][2] and D[a+1][0]==D[a+1][2] and D[a+2][0]==D[a+2][2]:
        han=1
if han==1:
    print("Yes")
else:
    print("No")

Solution (Python):


import sys

DEBUG = False


def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep=" "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n = read(int)
    zorome_times = 0
    for _ in range(n):
        dices = read_list(int)
        if dices[0] == dices[1]:
            zorome_times += 1
            if zorome_times >= 3:
                print("Yes")
                return
        else:
            zorome_times = 0
    print("No")


if __name__ == "__main__":
    main()

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

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

count = 0
for i in range(N):
    Di = list(map(int, input().split()))
    D.append(Di)

for i in range(N):
    Di = D[i]
    if Di[0] == Di[1]:
        count += 1
    else:
        count = 0
    if count >= 3:
        print("Yes")
        break
else:
    print("No")

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

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

for i in range(N):
    d_1, d_2 = input().split()
    if d_1 == d_2:
        count += 1
    else:
        count = 0

    if count == 3:
        break
    else:
        pass

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

Solution (Python):
n =  int(input())
d = [list(map(int,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:
            print('Yes')
            break
    else:
        cnt = 0
else:
    print('No')

Solution (Python):
N = int(input())
flug = False
cnt = 0
for _ in range(N):
    D1, D2 = list(map(int, input().split())) 
    if D1 == D2:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        flug = True
if flug:
    print("Yes")
else:
    print("No")

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

count = 0
for num in range(n):
  s,t = input().split()
  if s == t:
    count +=1
    if count == 3:
      print("Yes")
      exit()
  else:
    count = 0

print("No")

Solution (Python):
N=int(input())
A=0
list=[]
for i in range(N):
    date=input().split(" ")
    if date[0]==date[1]:
        A += 1
    else:
        list.append(A)
        A=0
list.append(A)
list=sorted(list)
if list[-1]>=3:
    print("Yes")
else:
    print("No")

Solution (Python):
n_num = int(input())
zoro_cnt = 0
flag = False
for n in range(n_num):
    a, b = map(int, input().split())
    if zoro_cnt != 0 and a != b:
        zoro_cnt = 0
    elif a == b:
        zoro_cnt += 1
        if zoro_cnt == 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)]

flag = 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]:
    flag = 1
  if flag:
    break

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

Solution (Python):
N = int(input())
D = [list(map(int,input().split())) for c in range(N)]
cnt = 0
ma = 0
for i in range(N):
    if D[i][0] == D[i][1]:
        cnt +=1
        if cnt>ma:
            ma = cnt
    else:
        cnt = 0

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

Solution (Python):
from collections import deque
import sys, copy, itertools,heapq
input = sys.stdin.readline

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

count = 0
ans = 'No'

for i in range(n):
  if D[i][0] == D[i][1]:
    count += 1
  else:
    count = 0
  if count == 3:
    ans = 'Yes'
    break

print(ans)

Solution (Python):

n = int(input())

cnt = 0
max_cnt = 0
for _ in range(n):
    a, b = map(int, input().split())
    if a == b:
        cnt += 1
        max_cnt = max(max_cnt, cnt)
    else:
        cnt = 0

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

Solution (Python):
import sys
import math



s = int(input())
rolls = []
count = 0
flag = False
while s:
	temp = [int(x) for x in input().split()]
	if temp[0] == temp[1]:
		count += 1
	else:
		count = 0

	if count == 3:
		flag = True





	s -= 1

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

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

Solution (Python):

















import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
flag = False
dices = []
for i in range(N):
    a, b = list(MAP())
    if a == b:
        dices.append(True)
    else:
        dices.append(False)

for i in range(N - 2):
    if dices[i] and dices[i + 1] and dices[i + 2]:
        flag = True

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

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

Solution (Python):
N = int(input())
check = []
for i in range(N):
  D1, D2 = list(map(int, input().split()))
  if(D1 == D2):
    check.append(1)
  else:
    check.append(0)

for i in range(N-2):
  zoromeflag = 0
  for j in range(i,i+3):
    if(check[j]==0):
      zoromeflag = 0
      break
    else:
      zoromeflag = 1
  if(zoromeflag == 1):
    break
if(zoromeflag == 1):
  print("Yes")
else:
  print("No")

Solution (Python):
n = int(input())
p = 0
f = 0
for i in range(n):
	d = input().split()
	if d[0] == d[1]:
		p += 1
	else:
		p = 0
	if p == 3:
		f = 1
if f == 1:
	print("Yes")
else:
	print("No")

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

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

print("Yes" if "True, True, True" in str([d[0]==d[1] for d in D]) else "No")

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

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

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

c = 0
flag = False
for i in range(N):
    c1, c2 = list(map(int, input().split()))
    if c1 == c2:
        c += 1
    elif c>0 and c1 != c2 and c<3:
        c = 0
    if c == 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)]

zoro = 0
now = 0
for i in range(n):
    if d[i][0] == d[i][1]:
        now += 1
        zoro = max(zoro,now)
    else:
        now = 0
if zoro >= 3:
    print('Yes')
else:
    print('No')

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
    else:
        cnt = 0

    if cnt == 3:
        ans = "Yes"

print(ans)

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

else:
    print("No")

Solution (Python):


n = int(input())
check_list = []
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        check_list.append(1)
    else:
        check_list.append(0)
flag = 0
for i in range(n - 2):
    if sum(check_list[i:(i+3)]) == 3:
        flag = 1
        break
if flag:
    print("Yes")
else:
    print("No")

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

ans = "No"
cnt = 0

for i in range(N):
    if D[i][0] == D[i][1]:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        ans = "Yes"

print(ans)

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

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

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

count = 0
out = 0
for _ in range(N):
  a, b = map(int, input().split())
  if a == b:
    count += 1
  else:
    count = 0
  if count >= 3:
    out = 1
    break

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

Solution (Python):
import numpy

N = int(input())
D = [list(map(int, input().split())) for _ in range(N)]
D = numpy.array(D)
D = D[:, 0] - D[:, 1]

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

        if count == 3:
            ans = 'Yes'
            break
    else:
        count = 0

print(ans)

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

Solution (Python):
import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

XY = np.array(read().split(), np.int64)[1:]
X, Y = XY[::2], XY[1::2]

A = (X == Y)
A = A[:-1] & A[1:]
A = A[:-1] & A[1:]

print('Yes' if np.any(A) else 'No')

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

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

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

Solution (Python):
N = int(input())
flg = 0
count = 0
for n in range(N):
    D = list(map(int,input().split()))
    if D[0]==D[1]:
        count+=1
        if count ==3:
            flg=1
    else:
        count=0
if flg==1:
    print("Yes")
else:
    print("No")

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

    cnt = 0
    for i in range(N):
        da, db = tuple([int(_x) for _x in input().split()])

        if da == db:
            cnt += 1
        else:
            cnt = 0

        if cnt == 3:
            print("Yes")
            return
    print("No")


main()

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

cnt = 0
flg = False
for i in range(n):
    if d[i][0] == d[i][1]: 
        cnt += 1
    else: 
        cnt = 0
    if cnt >= 3:
        flg = True
        break

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

Solution (Python):
n = int(input())
d = [tuple(map(int, input().split())) for _ 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")
        raise SystemExit(0)
print("No")

Solution (Python):
import math
import sys
import os

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")


N = I()
D = [LI() for _ 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:
        print('Yes')
        exit()
ans = 'No'

print(ans)

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

D = []
for _ in range(N):
    a, b = map(int, input().split())
    if a == b:
        D.append('1')
    else:
        D.append('0')
D = ''.join(D)
ans = False
if '1'*3 in D:
    ans = True
print('Yes' if ans else 'No')

Solution (Python):
N = int(input())
ans = 'No'
ls = []
for i in range(N):
    d1,d2 = map(int,input().split())
    ls.append([d1,d2])
ii = 0
for i in range(N):
    if ls[i][0] == ls[i][1]:
        ii += 1
    else:
        ii = 0

    if ii == 3:
        ans = 'Yes'
        break
print(ans)

Solution (Python):
n = int(input())
cnt = 0
for _ 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())
d=[list(map(int,input().split())) for _ in range(n)]
for i in range(n-2):
    if d[i][0]==d[i][1]:
        if d[i+1][0]==d[i+1][1]:
            if d[i+2][0]==d[i+2][1]:
                print("Yes")
                exit()
print("No")

Solution (Python):
import sys
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda: list(map(int, input().strip().split()))


def main():
	f = 0; flag = 0
	for i in range(int(input())):
		a, b = read()
		if a == b:f+=1
		else:f = 0

		if f == 3:flag |= 1
	print("YNeos"[flag == 0::2])

		



	

if __name__ == "__main__":
	main()

Solution (Python):
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
c = 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")
        break
    else:
        c += 1
        if c == n-2:
            print("No")
            break

Solution (Python):
N = int(input())
pre2 = [0,0]
pre1 = [0,0]
cur = [0,0]
cnt = 0
flg = 0
for i in range(N):
    if i == 0:
        pre2 = list(map(int,input().split()))
        if pre2[0] == pre2[1]:
            cnt += 1
    elif i == 1:
        pre1 = list(map(int,input().split()))
        if pre1[0] == pre1[1]:
            cnt += 1
    else:
        cur = list(map(int,input().split()))
        if cur[0] == cur[1]:
            cnt += 1
            if cnt == 3:
                flg = 1
                cnt = 0
        else:
            cnt = 0
        pre2 = pre1
        pre1 = cur
if flg:
    print('Yes')
else:
    print('No')

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

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

s = ""
for _ in range(n):
    d1,d2 = input().split()
    if d1==d2:
        s+="1"
    else:
        s+="0"

try:
    a = max([len(x) for x in re.findall(r"1+", s)])
    if a >= 3:
        print("Yes")
    else:
        print("No")
except:
    print("No")

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

def doublet(i):
    return D[i][0] == D[i][1]

def tripledoublet():
    for i in range(N-2):
        if doublet(i) and doublet(i+1) and doublet(i+2):
            return 'Yes'
    else:
        return 'No'

print(tripledoublet())

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

Solution (Python):
import numpy as np

N=int(input())

D=[]

for i in range(N):
    D.append(np.array(input().split(" "),dtype=np.int64))

cnt=0
max_cnt=0
for i in range(N):
    if(D[i][0]==D[i][1]):
        cnt+=1
    else:
        if(cnt>max_cnt):
            max_cnt=cnt
        cnt=0

if(cnt>max_cnt):
    max_cnt=cnt

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

Solution (Python):
N = int(input())
count = 0
success = False

for i in range(N):
  n_list = [int(n) for n in input().split(' ')]
  if n_list[0] == n_list[1]:
    count += 1
    if count == 3:
      success = True
      break
  else:
    count = 0

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

Solution (Python):

def main():
    n = int(input())
    cnt = 0
    max = 0
    for i in range(n):
        d1, d2 = map(int, input().split(" "))
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0
        if max < cnt:
            max = cnt
    if max >= 3:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

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

cnt = 0
for e in l:
    if e[0] == e[1]:
        cnt += 1

    if cnt == 3:
        print("Yes")
        exit()

    if e[0] != e[1]:
        cnt = 0

print("No")

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

def resolve():
    count = 0
    ans = "No"
    for i in range(N):
        A = input().split()
        if A[0] == A[1]:
            count += 1
            if count == 3:
                ans = "Yes"
                return ans
        else:
            count = 0
    return ans
print(resolve())

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

seq = 0
prev = False
for i in range(N):
    if D1[i] == D2[i]:
        if not prev:
            prev = True
            seq = 1
        else:
            seq += 1
        if seq >= 3:
            print("Yes")
            exit()
    else:
        prev = False
print("No")

Solution (Python):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)



n = inp()
cnt = 0
mx = 0
for i in range(n):
    d1, d2 = inpl()
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    mx = max(mx, cnt)

if mx >= 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):
num = int(input())

count = 0
is_ok = 0
for i in range(num):
    num1, num2 = map(int, input().split())
    if num1 == num2:
        count += 1
        if count >= 3:
            is_ok =1
    else:
        count = 0
        continue

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

Solution (Python):
N = int(input())
l = [0]*N
for i in range(N):
    a,b = [int(x) for x in input().split()]
    if a == b:
        l[i] = 1
for i in range(1,N):
    if l[i] == 1:
        l[i] = l[i-1] + 1
    else:
        l[i] = 0
if max(l) >= 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()

    if a != b:
        cnt = 0

print('No')

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

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

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

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

print(ans)

Solution (Python):
print("YNeos"["000" not in "".join([str(eval(input().replace(" ","-")))for _ in "_"*int(input())])::2])

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

Solution (Python):
n = int(input())
d_1 = []
d_2 = []

for i in range(n):
        a = list(map(int, input().split()))
        d_1.append(a[0])
        d_2.append(a[1])

for i in range(n-2):
        if d_1[i] == d_2[i] and d_1[i+1] == d_2[i+1] and d_1[i+2] == d_2[i+2]:
                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
    else:
        count=0
    if count>=3:
        print('Yes')
        exit()

print('No')

Solution (Python):

n = int(input())

cnt = 0
for i in range(n):
    d_1, d_2 = list(map(int, input().split()))
    if d_1 == d_2:
        cnt += 1
    else:
        cnt = 0

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

print('No')

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