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):
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')

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

main()

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

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

Solution (Python):
cnt = 0
zorome = 0
num = int(input())

while cnt < num:
  mass = input().split()
  
  if(mass[0] == mass[1]):
    zorome += 1
    
    if(zorome >= 3):
      break
  else:
    zorome = 0
  
  cnt += 1

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

Solution (Python):

import base64
import subprocess
import zlib


exe_bin = "c$~

open("./kyomu", 'wb').write(zlib.decompress(base64.b85decode(exe_bin)))
subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

Solution (Python):
import sys

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

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

for d1,d2 in d:
  if d1==d2:
    cnt+=1
  else:
    cnt=0
  if 3<=cnt:
    print("Yes")
    sys.exit()

print("No")

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

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:
    tmp = 0
  ans = max(ans, tmp)

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

Solution (Python):
N = int(input())
number = [0]*N
for i in range(N):
    a,b = map(int,input().split())
    if a==b:
        number[i]=1

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

print("No")

Solution (Python):
n=int(input())
l = [list(map(int,input().split())) for i in range(n)]
ans='No'
    
for i in range(n-2):

    if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
        ans='Yes'
    
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:
            break
    else:
        cnt=0
if cnt>=3:
    print("Yes")
else:
    print("No")

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

Solution (Python):
N = int(input())
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
    
    if i == N-1:
        print("No")

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

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

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

Solution (Python):
a = int(input())
l = []
c,f =0, 0
for i in range(a):
    ta,tb = map(int,input().split())
    if ta==tb : c+=1
    else: c = 0
    if c>=3 : f = 1
print('YNeos'[f==0::2])

Solution (Python):
import sys

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

print("No")

Solution (Python):
a = int(input())
l = []
c,f =0, 0
for i in range(a):
    ta,tb = map(int,input().split())
    if ta==tb : c+=1
    else: c = 0
    if c>=3 : f = 1
if f:
    print("Yes")
else:
    print("No")

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  
ra = range
enu = enumerate


def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def a_int(): return int(readline())


def ints(): return list(map(int, readline().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, readline().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, readline().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter, xor, add
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  
from functools import reduce
from math import gcd


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


N = a_int()
D1, D2 = read_col(N)

cnt = 0
for d1, d2 in zip(D1, D2):
    if d1 == d2:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 3:
        exit('Yes')
print('No')

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

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"
                break
print(ans)

Solution (Python):

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

Solution (Python):
c=0
for _ in range(int(input())):
  d,_,e=input()
  if d==e: c+=1
  else: c=0
  if c>2: exit(print('Yes'))
print('No')

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

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

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

Solution (Python):
n = int(input())
s = 0
b = False
for _ in range(n):
    w = input().split()
    if w[0] == w[1]:
        s += 1
        if s == 3:
            b = True
            break
    else:
        s = 0
print('Yes' if b else 'No')

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

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

Solution (Python):
import sys

input = sys.stdin.readline

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

    print(ans)

if __name__ == '__main__':
    main()

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

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

Solution (Python):
N = int(input())
flag = 0
state = 0
dic = {}
for i in range(N):
    a, b = map(int, input().split())
    if a == b:
        state += 1
    else:
        state = 0
    if state >= 3:
        flag = 1

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

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

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

Solution (Python):
def II(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
N=II()
List=[]
for i in range(N):
  tmp=LI()
  List.append(tmp)
cnt=0
Max=0
for i in range(N):
  if List[i][0]==List[i][1]:
    cnt+=1
  else:
    cnt=0
  Max=max(cnt,Max)
if Max>=3:
  print('Yes')
else:
  print('No')

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    D = [list(map(int, rl().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')
            return
    print('No')


if __name__ == '__main__':
    solve()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    d1_0, d2_0 = -1, -2
    d1_1, d2_1 = -1, -2
    d1_2, d2_2 = -1, -2
    for i in range(n):
        d1_2, d2_2 = d1_1, d2_1
        d1_1, d2_1 = d1_0, d2_0
        d1_0, d2_0 = map(int,input().split())
        if d1_0 == d2_0 and d1_1 == d2_1 and d1_2 == d2_2:
            print("Yes")
            sys.exit()
    print("No")

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n = int(input())
    d1_0, d2_0 = -1, -2
    d1_1, d2_1 = -1, -2
    d1_2, d2_2 = -1, -2
    for i in range(n):
        d1_2, d2_2 = d1_1, d2_1
        d1_1, d2_1 = d1_0, d2_0
        d1_0, d2_0 = map(int,input().split())
        if d1_0 == d2_0 and d1_1 == d2_1 and d1_2 == d2_2:
            print("Yes")
            sys.exit()
    print("No")

if __name__=='__main__':
    main()

Solution (Python):
N=int(input())
D=[]
for i in range(N):
    D.append(list(map(int,input().split())))
def total(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')
            return
    print('No')
    return
total(N)

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

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

Solution (Python):
import sys
def main():
	n=int(input()) 
	idx=[] 
	c=0 
	for i in range(n):
		x,y=map(int,input().split()) 
		if x==y:
			idx.append(c) 
		c+=1  
	if len(idx)<3:
		print('No') 
	else:
		flag=False 
		
		for i in range(len(idx)-2): 
			if idx[i]-idx[i+1]==-1 and idx[i+1]-idx[i+2]==-1:
				flag=True  
				break 
		dd={False:'No',True:'Yes'}
		print(dd[flag])
 
try:
	sys.stdin = open('INP01.txt', 'r')  

	
	sys.stdout = open('out.txt', 'w')   
	main() 
except:
	main()

Solution (Python):
N=int(input())
flag=0
count=0
for i in range(N):
    d1,d2=map(int,input().split())
    if(d1==d2):
        count+=1
    else:
        count=0
    if(count==3):
        flag=1
        break
if(flag==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:
        count = 0

print("No")

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

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

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

cnt = 0
for i, j in d:
    if i == j:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        exit()
print("No")

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

rolls = []

for i in range(num_of_rolls):
    result = input().split()
    rolls.append((result[0], result[1]))

combo = 0

for pair in rolls:
    if pair[0] == pair[1]:
        combo += 1
    else:
        combo = 0
    
    if combo == 3:
        print('Yes')
        exit()

print('No')

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

Solution (Python):
N=int(input())
count=0
ans='No'

for i in range(N):
    d,e = map(int,input().split())
    if d==e:
        count += 1
        if count == 3:
            ans='Yes'
    else:
        count = 0

print(ans)

Solution (Python):
from sys  import stdin,stdout
 
st=lambda:list(stdin.readline().strip())
li=lambda:list(map(int,stdin.readline().split()))
mp=lambda:map(int,stdin.readline().split())
inp=lambda:int(stdin.readline())
pr=lambda n: stdout.write(str(n)+"\n")
 
mod=1000000007
INF=float('inf')


 
 
for _ in range(1):
    n=inp()
    f=0
    ans=0
    for i in range(n):
        a,b=mp()
        if a==b:
            ans+=1
        else:
            ans=0
        if ans==3:
            f=1
            break
    if f:
        pr('Yes')
    else:
        pr('No')

Solution (Python):
print('NYoe s'[' 1 1 1'in' '.join(str(len({*t.split()}))for t in open(0))::2])

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

count = 0

for i in range(0, n):
    if c[i] == d[i]:
        count += 1
    else:
        count = 0
    if count == 3:
        break

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

else:
    print('No')

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

Solution (Python):

import sys
input = sys.stdin.readline
from bisect import bisect_left;
from bisect import bisect_right;
from math import ceil, factorial;

def ceil(x):
    if x != int(x):
        x = int(x) + 1;
    return x;
    

def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp;


def gcd(a,b):
    if b == 0:
        return a;
    return gcd(b, a % b);


def nCr(n, k, modulus = 1): 
    if(k > n - k): 
        k = n - k; 
    res = 1;
    for i in range(k): 
        res = res * (n - i);
        res = res / (i + 1);
        res %= modulus; 
    return int(res);


def primefs(n):
    
    primes = {}
    while(n%2 == 0 and n > 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0 and n > 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    
    
    return primes


def power(x, y, p): 
    res = 1
    x = x % p  
    if (x == 0) : 
        return 0
    while (y > 0) : 
        if ((y & 1) == 1) : 
            res = (res * x) % p 
        y = y >> 1      
        x = (x * x) % p 
    return res 


def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b;









def find(x, link):
    p = x;
    while( p != link[p]):
        p = link[p];
    
    while( x != p):
        nex = link[x];
        link[x] = p;
        x = nex;
    return p;




def union(x, y, link, size):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x


def sieve(n): 
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime


MAXN = int(1e5 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    




def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret;
    
    


def int_array():
    return list(map(int, input().strip().split()));

def float_array():
    return list(map(float, input().strip().split()));


def str_array():
    return input().strip().split();


MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');




















n = int(input()); ans = 0; x = 0;
for i in range(n):
    a, b = int_array();
    if a == b:
        x += 1;
    else:
        x = 0;
    ans = max(x, ans);

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

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

Solution (Python):
n = int(input())
c = 0
isthere = 0
for i in range(n):
    nums = [int(prefix_sum) for prefix_sum in input().split()]
    if nums[0] == nums[1]:
        c = c + 1
    else:
        c = 0

    if c >= 3:
        isthere = 1

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

Solution (Python):
N = int(input())
S = []
judge = 0
for i in range(N):
    S += [input().split()]
for i in range(N):
    if i <= N-3:
        if S[i][0] == S[i][1]:
            if S[i+1][0] == S[i+1][1]:
                if S[i+2][0] == S[i+2][1]:
                    print("Yes")
                    judge = 1
                    break
if judge == 0:
    print("No")

Solution (Python):
def main():
    import sys
    ikimasu = sys.stdin.buffer.readline
    ini = lambda: int(ins())
    ina = lambda: list(map(int, ikimasu().split()))
    ins = lambda: ikimasu().strip()
    
    n= ini()
    tmp = 0
    for _ in range(n):
        l,r = ina()
        if(l==r):
            tmp+=1
            if(tmp==3):
                print("Yes")
                return
        else:
            tmp =0
    print("No")
        


        


    




















if __name__ == "__main__":
    main()

Solution (Python):
import sys

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

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

Solution (Python):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

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

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

c = 0
for i, j in d:
    if i==j:
        c += 1
        if c == 3:
            print('Yes')
            import sys
            sys.exit()
    else:
        c = 0
print('No')

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

t = 0
max_run_length = 0
for _ in range(N):
    D1, D2 = map(int, input().split())
    if D1 == D2:
        t += 1
    else:
        t = 0
    max_run_length = max(max_run_length, t)

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

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

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

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

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

z_counter = 0
flg = False

for i in range(roop_num):
  if(x[i] == y[i]):
    z_counter = z_counter +1
  else:
    z_counter = 0
  if(z_counter == 3):
    flg = True
    break

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

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

Solution (Python):
def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

n = NextInt()
da = [NextIntList() for i in range(n)]
cnt, ans = 0, 0
for i in range(n):
    if(da[i][0] == da[i][1]):
        cnt += 1
    else:
        cnt = 0
    ans = max(ans, cnt)
if ans >= 3:
    print('Yes')
else:
    print('No')

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

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

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

count = 0
for i in range(n):
    if ds[i][0] == ds[i][1]:
        count += 1
        if count == 3:
            print("Yes")
            exit(0)
    else:
        count = 0
print("No")

Solution (Python):
amt = int(input())
same = 0

while amt > 0:
    item = list(map(int, input().split()))
    if item[0] == item[1]:
        same += 1
        if same == 3:
            print("Yes")
            amt = 0
    else:
        same = 0
    amt -= 1

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

Solution (Python):
def judge():
    cnt = 0  
 
    for _ in range(N):
        x, y = map(int, input().split())
        if x == y:
            
            cnt += 1
        else:
            
            cnt = 0
 
        if cnt == 3:
            
            return True
    
    
    return False
 
N = int(input())
 
if judge():
    print("Yes")
else:
    print("No")

Solution (Python):
N = int(input())
flag = 0
ans = "No"
for i in range(N):
  A,B = input().split()
  if A == B:    
    flag += 1
  else:
    flag = 0
  if flag == 3:
    ans = "Yes"
    break
    
print(ans)

Solution (Python):
def judge():
    cnt = 0  

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

        if cnt == 3:
            
            return True
    
    
    return False

N = int(input())

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

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

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

Solution (Python):
c=int(input())
ans=0
now=0
for _ in range(c):
  if eval(input().replace(" ","==")):
    now = now+1
  else:
    now = 0
  ans = max(ans,now)
print("Yes") if ans >= 3 else print("No")

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

Solution (Python):
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
import random

bool=False
p=0
for _ in range(int(input())):
    a,b=INPUT()
    if a==b:
        p+=1
    else:
        p=0
    if p>=3:
        bool=True
if bool:
    print("Yes")
else:
    print("No")

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

Solution (Python):
'''
自宅用PCでの解答
'''
import math

import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"
INF = 1<<32-1


def main():
    n = int(ipt())
    cnt = 0
    for i in range(n):
        a,b = map(int,ipt().split())
        if a == b:
            if cnt == 2:
                print("Yes")
                exit()
            else:
                cnt += 1
        else:
            cnt = 0
    print("No")

    return None

if __name__ == '__main__':
    main()

Solution (Python):

def resolve():
    N = int(input())
    cnt = 0
    for _ in range(N):
        a, b = map(int, input().split())
        if a == b:
            cnt += 1
            if cnt == 3:
                return print("Yes")
        else:
            cnt = 0

    print("No")


if __name__ == "__main__":
    resolve()

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

print("No")

Solution (Python):


def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    N = int(input())
    D_1, D_2 = [], []
    for i in range(N):
        D_i1, D_i2 = list(map(int, input().split()))
        D_1.append(D_i1)
        D_2.append(D_i2)

    return N, D_1, D_2


def main(N: int, D_1: list, D_2: list) -> None:
    """
    メイン処理.

    Args:\n
        N (int): サイコロを振った回数(3 <= N <= 100)
        D_1 (list): i回目の出目(1 <= D_i1 <= 6)
        D_2 (list): i回目の出目(1 <= D_i2 <= 6)
    """
    
    ans = "No"
    doublet_cnt = 0
    for i in range(N):
        if D_1[i] == D_2[i]:
            doublet_cnt += 1
        else:
            doublet_cnt = 0

        if doublet_cnt >= 3:
            ans = "Yes"
            break

    
    print(ans)


if __name__ == "__main__":
    
    N, D_1, D_2 = get_input()

    
    main(N, D_1, D_2)

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

Solution (Python):
n = int(input())
cou = 0
ans = False
for i in range(n):
	da, db = map(int, input().split())
	if da == db:
		cou += 1
	else:
		cou = 0
	if cou == 3:
		ans = True

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

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

Solution (Python):








if __name__ == "__main__":
    from sys import stdin as inp, stdout as out,setrecursionlimit as srl
    from collections import Counter,defaultdict,deque
    from heapq import *
    for _ in xrange(1):
        n=input()
        a=map(lambda x:x[0]==x[1],[map(int,inp.readline().split()) for i in  xrange(n)])
        print 'Yes' if any(all(a[i:i+3]) for i in xrange(n-2)) else 'No'

Solution (Python):
N = int(input())
cnt = 0
flg = False
for _ in range(N):
    a, b = map(int, input().split())
    if a != b:
        cnt = 0
    else:
        cnt += 1
    if cnt >= 3:
        flg = True

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

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

cnt = 0
ans = 0
for d1, d2 in d:
    if d1 == d2:
        cnt += 1
        if cnt >= 3:
            print('Yes')
            exit()
    else:
        cnt = 0

print('No')