peterverebics/CodeNet_Python_118 huggingface dataset:
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")
    break
  if i == n-3:
    print("No")
N=int(input())
ans = "No"
n=0
for _ in range(N):
    x, y = map(int, input().split())
    if x == y:
        n+=1
    else:
        n = 0
    if n >= 3:
        ans="Yes"
print(ans)
n = int(input())

nums = []
for i in range(n):
	nums.append(list(map(int, input().split())))
ans = 'No'
count = 0
for num in nums:
	if num[1] == num[0]:
		count += 1
		if count == 3:
			ans = 'Yes'
			break
	else:
		count = 0

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

ans = 0
flag = 0

for i in range(0, n):
    x, y = input().split()
    if x == y:
        ans = ans + 1
    else:
        ans = 0
    if ans >= 3:
        flag = 1
if flag == 1:
    print("Yes")
else :
    print("No")
N = int(input())


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

print(ans)
import sys
N=int(input())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())
#print(a[1])
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]:
        print("Yes")
        sys.exit()
print("No")
n=input()
a=[[int(i) for i in raw_input().split()]for j in range(n)]
flag=0
for i in range(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]:
        flag=1
if flag:
    print "Yes"
else:
    print "No"
n = int(input())
c = [0] * n
d = [0] * n
for i in range(n):
  c[i],d[i] = map(int,input().split())
f = 0

for i in range(n-2):
  if c[i] == d[i] and c[i+1] == d[i+1] and c[i+2] == d[i+2]:
    f = 1
if f == 0:
  print('No')
else:
  print('Yes')
N = int(input())
c = 0
for _ in range(N):
    di1, di2 = input().split(" ")
    if di1 == di2:
        c += 1
        if c == 3:
            print("Yes")
            break
    else:
        c = 0
else:
    print("No")
#!/usr/bin/env python3
import sys
import collections as cl


def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


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


def main():
    N = II()
    num = 0
    for i in range(N):
        a, b = MI()
        if a == b:
            num += 1
            if num == 3:
                print("Yes")
                return
        else:
            num = 0

    print("No")


main()
n = int(input())
d = []
for i in range(n):
    a,b = map(int,input().split())
    d.append([a,b])
cnt,ans = 0,0
for i in d:
    if i[0] == i[1]:
        cnt += 1
        ans = max(ans,cnt)
    else:
        cnt = 0
if ans>2:
    print("Yes")
else:
    print("No")
def dice(m, n):
    for i in range(0, n-2):
        if (m[i][0] == m[i][1]) and (m[i + 1][0] == m[i + 1][1]) and (m[i + 2][0] == m[i + 2][1]): 
            return 'Yes'
    return 'No'

N = int(input())
mylist = []
for i in range(0, N):
    num = list(map(int, input().split(' ')))
    mylist.append(num)

print(dice(mylist, N))
def solve():
    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 > 2:
            print("Yes")
            exit()
    print("No")
    return 0

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

now = 0
ans = "No"
for i in range(N):
  x, y = map(int, input().split())
  if x == y:
    now += 1
    if now == 3:
      ans = "Yes"
  else:
    now = 0
    
print(ans)
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')
            exit()
    else:
        cnt=0
print('No')
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')
n = int(input())

renzoku = 0
flag = 0
for i in range(n):
  d = list(map(int, input().split()))
  if d[0] == d[1]:
    renzoku += 1
    if renzoku == 3:
      flag = 1
      break
  else:
    renzoku = 0
  
if flag == 0:
  print("No")
else:
  print("Yes")
N = int(input())
D1, D2 = [], []
for i in range(N):
  li = list(map(int,input().split()))
  D1.append(li[0])
  D2.append(li[1])

for i in range(N-2):
  if D1[i]==D2[i] and D1[i+1]==D2[i+1] and D1[i+2]==D2[i+2]:
    print('Yes')
    break
else:
  print('No')
def resolve():
    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')
            return
    print('No')

if __name__ == "__main__":
    resolve()
N=int(input())
D=[]
count=0
ans=0
for i in range(N):
    a,b=map(int,input().split())
    D.append([a,b])
    if a==b:
        count+=1
    else:
        count=0
    if count==3:
        ans+=1
if ans>=1:
    print("Yes")
else:
    print("No")
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')
N = int(input())

mycnt = 0
flag = 0
for n in range(N):
    a, b = map(int, input().split())
    if a == b:
        mycnt += 1
        if mycnt >= 3:
            flag = 1
    else:
        mycnt = 0
if flag == 1:
    print('Yes')
else:
    print('No')
import sys
N = int(input())
x = 0
for i in range(N):
  a,b = map(int,input().split())
  if a == b:
    x += 1
  else:
    x = 0
  if x == 3:
    print("Yes")
    sys.exit()
print("No")
n = input()
dlist = []
count = 0

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

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

if count == 3:
  print("Yes")
else:
  print("No")
def main():
    N  = int(input())
    Ds = [list(map(int,input().split())) for _ in range(N)]
    count = 0
    for D in Ds:
        if D[0]==D[1]:
            count += 1
        else:
            count = 0
        if count == 3:
            print("Yes")
            return
    print("No")
    
main()
N = int(input())
D1 = [0] * N
D2 = [0] * N
for i in range(N):
    D1[i], D2[i] = input().split()

flg = False
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]:
        flg = True
        # break
if flg:
    print("Yes")
else:
    print("No")
N = int(input())
D1 = [0]*N
D2 = [0]*N
for i in range(N):
    D1[i],D2[i] = map(int, input().split())
    
check = 0
for i in range(N):
    if D1[i]==D2[i]:
        check += 1
    else:
        check = 0
        
    if check == 3:
        break
        
if check >= 3:
    print("Yes")
else:
    print("No")
num = int(input())

count = 0
flag = False
for i in range(num):
    a,b = input().split()
    if a == b:
        count += 1
        if count >= 3:
            print("Yes")
            flag = True
            break
    else:
        count = 0
if not flag:
    print("No")
rolls = []
for _ in range(int(input())):
  x,y = list(map(int,input().split()))
  rolls.append((x,y))
n = len(rolls)
i = 0
curr = 0
answer = False;
while i < n:
  if rolls[i][0] == rolls[i][1]:
    curr+=1;
    if curr == 3:
      answer = True;
      break;
    i+=1
  else:
    curr = 0
    i+=1;
if answer:
  print("Yes")
else:
  print("No")
# 2020/09/19
# AtCoder Beginner Contest 179 - B

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

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

# Output
print(ans)
N = int(input())

max_zoro = 0
zoro = 0

for _ in range(N):
  a,b = map(int, input().split())
  if a==b:
    zoro += 1
    max_zoro = max(max_zoro, zoro)
  else:
    zoro = 0

if max_zoro >= 3:
  print('Yes')
else:
  print('No')
n=int(input())
l=[]
m=[]
for i in range(0,n):
  a,b=map(int,input().split())
  l.append(a)
  m.append(b)
c=0
i=0
while i<=n-3:
  if l[i]==m[i] and l[i+1]==m[i+1] and l[i+2]==m[i+2]:
      c=3
  i=i+1
if c==3:
  print('Yes')
else:
  print('No')
n = int(input())

result = False
count = 0
for i in range(n):
  a, b = map(int,input().split())
  if a == b:
    count += 1
    if count >= 3:
      result = True
      break
  else:
    count = 0
  
if result :
  print("Yes")
else :
  print("No")
def check():
  N = int(input())
  cnt = 0
  for i in range(N):
    a,b = map(int, input().split())
    if a==b:
      cnt += 1
      if cnt==3:
        return 'Yes'
    else:
      cnt = 0
  return 'No'
print(check())
n = int(input())
d = [list(map(int,input().split())) for _ in range(n)]
num = 0
ans = 0

for i in range(n):
    d1, d2 = d[i]
    if d1==d2:
        num += 1
        ans = max(ans, num)
    else:
        num = 0

if ans>=3:
    print("Yes")
else:
    print("No")
N=input()
n=int(N)
x=0
for s in range(n):
  ds1,ds2=input().split()
  if ds1==ds2:
    x+=1
  else:
    x=0
  if x==3:
    print("Yes")
    break
else:
  print("No")
N=int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]
cnt=0
result="No"
# 出力して確認
#for n in range(N-1):
for i in range(N):
    cnt=cnt+1 if x[i]==y[i] else 0
    if cnt>2:
        result="Yes"
print(result)
import sys

n = int(input())

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

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

if flag == 1:
  print("Yes")
else:
  print("No")
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")
n=int(input())
d=0
x=[0 for i in range(n)]
y=[0 for i in range(n)]
for i in range(n):
    x[i],y[i]=map(int,input().split())

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]):
        d=d+1
    else:
        d=d
if(d>0):
    print("Yes")
else:
    print("No")
n=int(input())

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

flag_a=0
flag_b=0
for i in range(n):
  if num_list[i][0]==num_list[i][1] :
    flag_a+=1
  else:
    flag_a=0
  
  if flag_a==3:
    flag_b=1
    
if flag_b==1:
  print('Yes')
else:
  print('No')
from typing import List, Any


def read_int() -> int:
    return int(input().strip())


def read_ints() -> List[int]:
    return list(map(int, input().strip().split(' ')))


def solve() -> Any:
    N = read_int()
    count = 0
    for _ in range(N):
        d0, d1 = read_ints()
        if d0 == d1:
            count += 1
            if count > 2:
                return 'Yes'
        else:
            count = 0
    return 'No'


if __name__ == '__main__':
    print(solve())
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")
N = int(input())

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

print("Yes" if ans >= 3 else "No")
cnt = input()
same_val_cnt = 0
ans = "No"
for _ in range(1,int(cnt)+1):
	a, b = input().split(" ")
	if a == b:
		same_val_cnt += 1
	else:
		same_val_cnt = 0

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

print(ans)
#B

N = int(input())
D = []
counter = []

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

for i in range(N):
  if D[i][0] == D[i][1]:
    counter.append(1)
    if (i >= 2 and counter[i-1]==1 and counter[i-2]==1):
      print('Yes')
      break
  else:
    counter.append(0)
  if i == N-1:
    print('No')
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')
import sys

n = int(input())
z = 0

for i in range(n):
  d1, d2 = map(int, input().split())
  if d1 != d2:
    z = 0
    continue

  z += 1
  if z >= 3:
    print('Yes')
    sys.exit()

print('No')
def main():
  n = int(input())
  result = []
  for i in range(n):
    d1, d2 = map(int, input().split())
    result.append(d1 == d2)
  for i in range(n-2):
    if result[i] and result[i+1] and result[i+2]:
      print("Yes")
      return 0
  print("No")
  return 0
    
if __name__ == "__main__":
  a = main()
n=int(input())
ans='No'
daice=[]
for i in range(n):
  daice.append(list(map(int,input().split())))
for j in range(n-2):
  if daice[j][0]==daice[j][1]:
    if daice[j+1][0]==daice[j+1][1]:
      if daice[j+2][0]==daice[j+2][1]:
        ans='Yes'
print(ans)
n = int(input())
d = [[] for _ in range(n)]
for i in range(n):
    d[i] = list(map(int, input().split()))
counter = 0
for i in d:
    if i[0] == i[1]:
        if counter == 2:
            print("Yes")
            exit()
        else:
            counter += 1
    else:
        counter = 0
print("No")
n = int(input())

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

    if count>=3:
        print('Yes')
        exit()
print('No')
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")
        break
else:
    print("No")
import os
import sys
from atexit import register
from io import BytesIO
sys.stdin = BytesIO(os.read(0, os.fstat(0).st_size))
sys.stdout = BytesIO()
register(lambda: os.write(1, sys.stdout.getvalue()))
input = lambda: sys.stdin.readline().rstrip('\r\n')
raw_input = lambda: sys.stdin.readline().rstrip('\r\n')

n = int(input())
ok = False
cont = 0
for i in xrange(n):
    a,b = (int(x) for x in input().split())
    if a == b:
        cont += 1
        if cont == 3:
            ok = True
    else:
        cont = 0
if ok:
    print("Yes")
else:
    print("No")
n = int(input())
cnt = 0
for _ in range(n):
    a,b = map(int,input().split())
    if(a==b):
        cnt += 1
    else:
        cnt = 0
    if(cnt==3):
        print('Yes')
        exit()
print('No')
n=int(input())
g=0
for i in range(n):
  a,b=map(int,input().split(" "))
  if a==b:
    g=g+1
    if g==3:
      break
      break
  else:
    g=0


if g==3:
  print("Yes")
else:
  print("No")
n = int(input())
cnt = 0
flag = False

for i in range(n):
  da, db = map(int, input().split())
  if da == db:
    cnt += 1
  else:
    cnt = 0
  
  if cnt == 3:
    flag = True
    
if flag:
  print("Yes")
else:
  print("No")
N = int(input())
D = [list(map(int,input().split())) for i in range(N)]
tmp = 0
ans = "No"
for i in range(N):
    if D[i][0] == D[i][1]:
        tmp += 1
    else:
        tmp = 0
    if tmp == 3:
        ans = "Yes"
print(ans)
def readinput():
    n=int(input())
    ab=[]
    for _ in range(n):
        a,b=map(int,input().split())
        ab.append((a,b))
    return n,ab

def main(n,ab):
    count=0
    for a,b in ab:
        if a==b:
            count+=1
            if count>=3:
                return 'Yes'
        else:
            count=0
    return 'No'

if __name__=='__main__':
    n,ab=readinput()
    ans=main(n,ab)
    print(ans)
N = int(input())
F_S = [list(map(int,input().split())) for _ in range(N)]

cnt = 0
for f,s in F_S:
  if cnt >= 3:
    break
  if f == s:
    cnt += 1
  else:
    cnt = 0
if cnt >= 3:
  print("Yes")
else:
  print("No")
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")
n = int(input())
d = []
cnt = 0

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

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

print('No')
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)
N = int(input())
D = list()
D.append(0)
for i in range(1, N + 1):
	x, y = input().split()
	s = 1 + D[i - 1]if x == y else 0
	D.append(s)
if 3 in D:
	print('Yes')
else:
	print('No')
n = int(input())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

cnt = 0

for i in range(n-2):
    c = a[i] - b[i] 
    if c == 0:
        d = a[i+1] - b[i+1]
        if d == 0:
            e = a[i+2] - b[i+2]
            if e == 0:
                cnt += 1

if cnt == 0:
    print('No')
else:
    print('Yes')
#B
N=int(input())
cnt=0
ans="No"
for i in range(N):
    a,b = map(int,input().split())
    if a==b:
        cnt +=1
    else:
        cnt=0
    if cnt==3:
        ans="Yes"
        break
print(ans)
N = int(input())
cnt = 0
ans = "No"
for _ in range(N):
    d, a = list(map(int, input().split()))
    if d == a:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        ans = "Yes"

print(ans)
t=int(input())
count = 0
flag = False
for test in range(t):
    a,b = map(int,input().split())
    if a==b:
    	count+=1
    	if count==3:
    		flag=True
    else:
    	count=0

if flag:
	print("Yes")
else:
	print("No")
n = int(input())
cnt = [False]*n

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

ans = 'No'

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

print(ans)
N = int(input())
val = 0
def mojicheck(a,b):
    if a==b:
        return 1
    else:
        return 0
flag = 0
for i in range(N):
    d1,d2 = map(int,input().split())
    flag = mojicheck(d1,d2)

    if flag == 0:
        val = 0
    elif flag == 1:
        val += 1
    if val ==3:
        break
if val >=3:
    print('Yes')
else:
    print('No')
N = int(input())
count = 0
result = False
for i in range(N):
    D1, D2 = map(int, input().split(" "))
    if D1 == D2:
        count = count + 1
        if count >= 3:
            result = True
    else:
        count = 0
if result:
    print('Yes')
else:
    print('No')
N = int(input())

M = 0
ans = 'No'

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

print(ans)
c=0
for _ in range(int(input())):
    x,y = map(int,input().split())

    if x==y:
        c+=1
    else:
        c=0
    if c==3:
        c=-1
        print('Yes')
        break
if c!=-1:
    print('No')
n=int(input())

count=0
c_list=[1]

for i in range(n):
    d1, d2=map(int, input().split())
    if d1==d2:
        count+=1
        c_list.append(count)
        #print(c_list)
    else:
        count=0
        
if max(c_list)>=3:
    print("Yes")
else:
    print("No")
import sys
input = sys.stdin.readline

N=int(input())
D=[tuple(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] and D[i+2][0]==D[i+2][1]:
        flag=1

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

def main():
    N = int(input())
    zoro = 0
    for i in range(N):
        Ds = [int(s) for s in sys.stdin.readline().split()]
        if(Ds[0] == Ds[1]):
            zoro += 1
            if(zoro > 2):
                print("Yes")
                return(0)
        else:
            zoro = 0
    print("No")

main()
n = int(input())
d = [list(map(int, input().split())) for _ in range(n)]
cnt = 0

for i in range(n):
    d1, d2 = d[i]
    if d1 == d2:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit(0)
    else:
        cnt = 0

print("No")
a =int( input())
_number=0;_kaerichi="No"
for i in range(a):
    b, c = map(int, input().split())
    if(b==c):
        _number+=1
    else:
        _number=0
        
    if(_number==3):
        _kaerichi="Yes"
print(_kaerichi)
n = int(input())
s = ''
for i in range(n):
  a, b = map(int, input().split(' '))
  if a == b:
    s += '1'
  else:
    s += '0'
    
if '111' in s:
  print('Yes')
else:
  print('No')
N = int(input())
happed = [list(map(int, input().split())) for _ in range(N)]
cnt = 0
for d1, d2 in happed:
    if d1 == d2:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    else:
        cnt = 0
print("No")
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)
import sys
N = int(input())
count = 0
for i in range(N):
    tmp = input().split()
    if tmp[0] == tmp[1]:
      count = count + 1
      if count >= 3:
        print("Yes")
        sys.exit()
    else:
      count = 0;

print("No")
N = int(input())

D = []
for _ in range(N):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        D.append(True)
    else:
        D.append(False)

for i in range(N-2):
    if D[i] and D[i+1] and D[i+2]:
        print('Yes')
        exit(0)
print('No')
n = int(input())
c = 0
for i in range(n):
  d,e = map(int, input().split())
  if d == e:
    c += 1
    if c == 3:
      print("Yes")
      break
  else:
    c = 0
else:
  print("No")
n = int(input())
 
ans = 'No'
count = 0
for i in range(n):
  a,b = map(int,input().split())
  if a==b:
    count += 1
    if count == 3:
      ans = 'Yes'
  else:
    count = 0
    
print(ans)
N = int(input())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

count=0
for i in range(0,N-2):
    if x[i]==y[i]:
        if x[i+1]==y[i+1]:
            if x[i+2]==y[i+2]:
                count = count+1
            else:
                pass
        else:
            pass
    else:
        pass

if count>0:
    print("Yes")
else:
    print("No")
N=int(input())

cnt=0
for _ in range(N):
  D1,D2=map(int,input().split())
  if D1==D2:
    cnt+=1
  else:
    cnt=0
    
  if cnt==3:
    print("Yes")
    break
else:
  print("No")
N=int(input())
cnt=0
maxcnt=0
for i in range(N):
  tmp = input().split()
  tmp1=int(tmp[0])
  tmp2=int(tmp[1])
  if tmp1 == tmp2:
    cnt+=1
  else:
    cnt=0
  
  if cnt > maxcnt:
    maxcnt=cnt
    
if maxcnt >= 3:
  print("Yes")
else:
  print("No")