defmodule Main do
  def main() do
    n = IO.gets("") |> String.trim() |> String.to_integer()
    a = Enum.map(1..n, fn _ -> IO.gets("") |> String.trim() |> String.split(" ") |> Enum.uniq() |> length() end)
    |> Enum.join() |> String.contains?("111")
    if a, do: IO.puts("Yes"), else: IO.puts("No")
  end
end