open Batteries
let n = read_int ()
let rec loop i zoro_count =
  if i >= n then false else
  if zoro_count >= 3 then true else (
    Scanf.sscanf (read_line()) "%d %d" (fun d1 d2 -> 
      if d1 = d2 then loop (i+1) (zoro_count+1) else loop (i+1) 0
    )
  )

let () = (if (loop 0 0) then "Yes" else "No") |> print_endline