let () =
  Scanf.scanf "%d\n" @@ fun n ->
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun a b -> a = b in
  let (ans,_) = Array.fold_left 
  	(fun (ans, now) b -> 
    	if b && (now = 2) then (ans+1,0) 
        else if b then (ans, now+1) 
        else (ans, 0)) (0,0) arr in
  Printf.printf "%s\n" (if ans > 0 then "Yes" else "No")