local n = io.read("*n")
local len = 0
local maxlen = 0
for i = 1, n do
  a, b = io.read("*n", "*n")
  if a == b then
    len = len + 1
  else
    len = 0
  end
  maxlen = math.max(maxlen, len)
end
print(3 <= maxlen and "Yes" or "No")
