import itertools D = list(map(int, input().split())) for lst in itertools.permutations(D): ok = True for i in range(1, 6): a = lst[i - 1] b = lst[i] c = lst[i + 1] if a < c < b or b < a < c: pass else: ok = False break if ok: print("YES") exit() else: print("NO")