program abc68
 implicit none
 integer(8)::N,ia,ib,c=0
 integer(8),allocatable::a(:),b(:)
 read(*,*)N
 allocate(a(N),b(N))
 do ia=1,N
  read(*,*)a(ia),b(ia)
 end do
 do ib=1,N-2
  if(a(ib)==b(ib).and.a(ib+1)==b(ib+1).and.a(ib+2)==b(ib+2))then
   c=1
   exit
  end if
 end do
 if(c==1)then
  print'(a)',"Yes"
 else
  print'(a)',"No"
 end if
 deallocate(a,b)
end program abc68