import numpy as np
import math
def permutations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r))

def A():
    xlist  = list(map(int,input().split()))
    xnp = np.array(xlist)
    xplace = np.where(xnp==0)
    print(str(xplace[0][0]+1))
def B030():
    import math
    n,m = map(int,input().split())
    n = n%12

    longs = 360*m/60
    shorts = 360*n/12+m/60*30

    print("%2.4f" % min(abs(longs-shorts),360-abs(longs-shorts)))

def AGC015_A():
    n,a,b = map(int,input().split())

    if n == 1:
        if a!=b:
            print("0")
            return
        else:
            print("1")
            return
    else:
        print(permutations_count(b-a+1,n-2))

def ABC107_A():
    n,i=map(int,input().split())
    print(n-i+1)

def ABC172_A():
    import math
    a = int(input())
    print(a+pow(a,2)+pow(a,3))

def ABC172_B():
    s = input()
    t = input()

    counter=0
    for i in range(len(s)):
        if s[i] != t[i]:
            counter += 1
    if counter == len(s):
        print(counter)
    else:
        print(counter)

def ABC172_C():
    import sys
    sys.setrecursionlimit(4100000)

    n,m,k = map(int,input().split())
    a = list(map(int,input().split()))
    b = list(map(int,input().split()))

    if k < a[0] or k < b[0]:
        print(0)
        return

    minamo = []
    def saiki(i,j,sum,mx):
        if sum >= k:
            mx = min(i+j,mx)
            return mx

        if i+j >= mx:
            return mx

        if i+1 <= n:
            mx = saiki(i+1,j,sum+a[i],mx)
        if j+1 <= m:
            mx = saiki(i,j+1,sum+b[j],mx)

        return mx

    mls = saiki(0,0,0,pow(10,5))
    print(mls)



def ABC172_Dd():
    def make_divisors(n):
        lower_divisors , upper_divisors = [], []
        i = 1
        while i*i <= n:
            if n % i == 0:
                lower_divisors.append(i)
                if i != n // i:
                    upper_divisors.append(n//i)
            i += 1
        return lower_divisors + upper_divisors[::-1]

    n = int(input())
    sum = 0
    for i in range(1,n+1):
        sum += i * len(make_divisors(i))
    print(sum)

def ABC172_D():
    def num_divisors_table(n):
        table = [0] * (n + 1)

        for i in range(1, n + 1):
            for j in range(i, n + 1, i):
                table[j] += 1

        return table

    a = num_divisors_table(4)
    print(a)

def ABC046_B():
    import numpy as np
    n,k = map(int,input().split())
    print(n,k)

    for i in range(n):
        ans = k*np.power(k-1,n-1)

    print(ans)

def CODE_festival_2016_A():
    import numpy as np
    N = int(input())
    a = np.array(list(map(int,input().split())))

    ans = 0
    for i in range(N):
        if i == a[a[i]-1]-1:
            ans += 1

    print(int(ans) if ans%2==1 else int(ans/2))

def abc054_b():
    import pandas as pd
    N,M = map(int,input().split())
    a = [input() for i in range(N)]
    b = [input() for i in range(M)]

    ans1=0
    a_df = pd.DataFrame(a)
    for m in range(M):
        for n in range(N):
            if a_df.iloc[:,0].str.contains(b[m])[n]:
                ans1+=1

    a_dfT = pd.DataFrame(a).T
    b = pd.DataFrame(b).T.to_numpy().tolist()[0]

    ans2=0
    for m in range(len(a_dfT)):
        for n in range(len(b)):
            if a_dfT.iloc[:,0].str.contains(b[n])[m]:
                ans2+=1

    if ans1==ans2:
        print("Yes" if ans1==len(b) else "No")
    else:
        print("No")

def test():
    import pandas as pd
    import numpy as np
    a = ["#.#",".#.","#.#"]; b = ["#.",".#"]


    ans1=0
    a_df = pd.DataFrame(a)
    for m in range(M):
        for n in range(N):
            if a_df.iloc[:,0].str.contains(b[m])[n]:
                print()
                ans1+=1

    a_dfT = pd.DataFrame(a).T
    b = pd.DataFrame(b).T.to_numpy().tolist()[0]

    ans2=0
    for m in range(len(a_dfT)):
        for n in range(len(b)):
            if a_dfT.iloc[:,0].str.contains(b[n])[m]:
                ans2+=1

    if ans1==ans2:
        print("Yes" if ans1==len(b) else "No")
    else:
        print("No")

'''
6 4
#.#
.#.
#.#
#.#
.#.
#.#
#.
.#
#.
.#
'''

def abc002_D():
    N,M = map(int,input().split())
    xy = [];people=[[] for i in range(N)]
    print(people)
    for i in range(M):
        xy = list(map(int,input().split()))

        people[xy[0]-1].append(xy[1])
        people[xy[1]-1].append(xy[0])

    print(people)

    Gatcha = 0
    for Order in range(N):
        for PeopleIndex in people[Order]:
            if Order in people[PeopleIndex-1]:
                Gatcha+=1
        if len(people(Order))==Gatcha:
            pass

def abc173_a():
    N = int(input())
    #N = 3000%1000
    if N%1000 ==  0:
        print(0)
    else:
        print(1000-N%1000)

def abc173_b():
    N = int(input())

    #AC WA TLE RE
    l = [0 for i in range(4)]

    for i in range(N):
        Inp = input()
        if Inp == "AC":
            l[0] += 1
        if Inp == "WA":
            l[1] += 1
        if Inp == "TLE":
            l[2] += 1
        if Inp== "RE":
            l[3] += 1

    print("AC x "+str(l[0]))
    print("WA x "+str(l[1]))
    print("TLE x "+str(l[2]))
    print("RE x "+str(l[3]))

def abc173_c():
    pass


def abc173_d():
    import sys
    sys.setrecursionlimit(4100000)
    N = int(input())
    a =  list(map(int,input().split()))


    a = sorted(a,reverse=True)

    Enkan = [a[0],a[1]]





    gokei = []
    def saiki(i,suma,Enkan):

        if i == N:
            gokei.append(sum(suma))
            return
        else:
            for k in range(len(Enkan)):

                if k != len(Enkan)-1:
                    suma.append(min(Enkan[k],Enkan[k+1]))
                    Enkan.insert(k,a[i])
                    saiki(i+1,suma,Enkan)
                    del Enkan[k]
                    del suma[-1]
                else:
                    suma.append(min(Enkan[-1],Enkan[0]))
                    Enkan.insert(0,a[i])
                    saiki(i+1,suma,Enkan)
                    del Enkan[0]
                    del suma[-1]

    saiki(2,[3],[a[0],a[1]])
    print(max(gokei))

def abc037_c():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))

    suma = 0
    ruiseki = [0]*(n+1)

    for i in range(n):
        ruiseki[i+1] = ruiseki[i] + a[i]
    #print(ruiseki)

    for i in range(n):

        suma += ruiseki[n-k+1+i] - ruiseki[i]
        #print(suma,n-k+1+i,i)
        if n-k+1+i == n:
            break
    print(suma)

def abc061_c():
    s = str(input())

    l = []
    def saiki(i,moji):
        if i == len(s)-1:
            #print(moji)
            l.append(sum(list(map(int,moji.split("+")))))
            return

        #いれる
        saiki(i+1,moji+"+"+s[i+1])
        #いれない
        saiki(i+1,moji+s[i+1])

    saiki(0,s[0])

    print(sum(l))

def abc104_c():
    d,g = map(int,input().split())
    plist = []; clist = []
    for i in range(d):
        Inp = list(map(int,input().split()))
        plist.append(Inp[0])
        clist.append(Inp[1])

    def saiki(i,sum):
        if sum > g:
            return

        saiki(i+1,sum+v_new)
        saiki(i+1,sum+v_new)

def agc037_a():
    import sys
    input = sys.stdin.readline

    S = input().rstrip('\n')
    left = ''
    now = ''
    ans = 0
    for i in range(len(S)):
        now += S[i]
        if left != now:
            ans += 1
            left = now
            now = ''
        # print(S[i], ans)
    print(ans)


def arc29_a():
    import numpy as np
    N = int(input())
    t = [int(input()) for i in range(N)]

    l = []
    plist = []
    def saiki(i,sum1,sum2):
        if i == N:
            l.append([sum1,sum2])
            return

        saiki(i+1,sum1+t[i],sum2)
        saiki(i+1,sum1,sum2+t[i])

    saiki(0,0,0)

    p = 10**4; ans = 0
    for i in range(len(l)):
        if abs(l[i][0]-l[i][1]) < p:
            p = abs(l[i][0]-l[i][1])
            ans = max(l[i][0],l[i][1])


    print(ans)

def EducationDPcontest_D():
    N, W = list(map(int,input().split()))

    w = []; v = []; weight=[]
    for i in range(N):
        INP = list(map(int,input().split()))
        w.append(INP[0])
        v.append(INP[1])

    def saiki(i,weight_sum,value_sum):
        #print(i,weight_sum,value_sum)
        if weight_sum <= W:
            print("ans",i,weight_sum,value_sum)
        else:
            return
        if i == N:
            return
        else:
            for j in range(i,N):
                saiki(i+1, weight_sum+w[j],value_sum+v[j])

    saiki(0,0,0)

def Msol_B():
    #a,b,c = list(map(int,input().split()))
    #K = int(input())

    a,b,c=[7,0,5]
    K = 3

    if a==0 or b==0 or c==0:
        print("No")
        exit()

    import math

    if a > b:
        b_a = abs(math.log2(b/a))+1
        #まずは切りさげ
        b *= math.pow(2,math.floor(b_a))
        if b > c:
            c_b = abs(math.log2(c/b))+1
            if math.floor(b_a)+math.floor(c_b) <= K:
                print("Yes")
            else:
                print("No")
        else:
            print("Yes")
    else:
        print("Yes")

def Msol_B_():
    import numpy as np
    #a,b,c = list(map(int,input().split()))
    #K = int(input())

    a,b,c=np.array([7,2,5],dtype=np.float64)
    K = 3

    for i in range(7):
        if K==1:
            print('No')
            return
        if a > b:
            temp = 2 * b
            b = temp
            K -= 1
        else:
            break

    for i in range(7):
        if  K ==1:
            print('No')
            return
        if b > c:
            temp = 2 * c
            c = temp
            K -= 1
        else:
            print()
            break

def Msol_C():
    n,k = list(map(int,input().split()))
    a = np.array(list(map(int,input().split())),dtype=np.float64)

    for i in range(n-k):
        if np.prod(a[i:i+k]) > np.prod(a[i+1:i+1+k]):
            print('Yes')
        else:
            print("No")


def abc177_d():
    n,m = list(map(int,input().split()))

    alist = [[] for i in range(m)]
    blist = [[] for i in range(m)]
    for i in range(m):
      a,b =list(map(int,input().split()))
      alist[i] = a
      blist[i] = b

    print(alist)
    print(blist)
    #知人をリストに入れる
    l = [[] for i in range(n+1)] #最初の要素は捨て
    for i in range(m):
      l[alist[i]].append(blist[i])
      l[blist[i]].append(alist[i])


    print(l)

def nani():
    import numpy as np
    from sklearn import preprocessing

    #インスタンス作成
    train = [1,2,3,4,5,5,6,7]
    scaler = preprocessing.MinMaxScaler().fit(train)

    #次のようなtempを入れてみる
    temp = [1,2,3,4,5,5,6,7]
    temp = scaler.transform(temp)

def abc179b():
    n = int(input())
    d1list = []
    d2list = []
    cnt = 0
    for i in range(n):
        d1,d2  = list(map(int,input().split()))
        d1list.append(d1)
        d2list.append(d2)

        #ぞろめ
        if d1 == d2:
            cnt += 1
        else:
            cnt = 0

        if cnt >2:
            print("Yes")
            return

    print("No")




















abc179b()


Measured memory_bytes: 27348