(defn read-int [x]
  (Integer/parseInt x))

(defn read-vec [x]
  (mapv (fn [a] (read-int a)) (clojure.string/split x #" ")))

(defn is-doublet? [[a b]]
  (= a b))

(defn read-lines [lines]
  (loop [line 0
         result []]
    (if (= line lines)
      result
      (recur (inc line) (conj result (read-vec (read-line)))))))

(defn find-doublet-possible [rolls]
  (loop [idx 0
         end (count rolls)
         doublets-cnt 0]
    (if (or (= idx end) (= doublets-cnt 3))
      doublets-cnt
      (if (is-doublet? (nth rolls idx))
        (recur (inc idx) end (inc doublets-cnt))
        (recur (inc idx) end 0)))))

(defn main []
  (let [n (read-int (read-line))
        rolls (read-lines n)
        doublets (find-doublet-possible rolls)]
    (if (> doublets 2)
      (println "Yes")
      (println "No"))))

(main)
    