local mfl = math.floor local function getpattern(n, patall, idx) local used = {} local retary = {} local div = patall for i = 1, n do used[i] = false end for i = n, 1, -1 do div = mfl(div / i) local v_idx = mfl(idx / div) idx = idx % div local tmp_idx = 0 for j = 1, n do if(not used[j]) then if(tmp_idx == v_idx) then table.insert(retary, j) used[j] = true break else tmp_idx = tmp_idx + 1 end end end end return retary end local function isZouKado(x1, x2, x3) return x1 < x3 and (x2 - x1) * (x3 - x2) < 0 end local d = {} for i = 1, 7 do d[i] = io.read("*n") end local found = false for i = 0, 5039 do local pat = getpattern(7, 5040, i) local t = true for j = 1, 5 do if not isZouKado(d[pat[j]], d[pat[j + 1]], d[pat[j + 2]]) then t = false break end end if t then found = true break end end print(found and "YES" or "NO")