from itertools import permutations def is_kadomatu(a, b, c): if a == c: return False return (a < b > c) or (a > b < c) def solve(): for xs in permutations(DD): for i in range(5): a, b, c = xs[i:i+3] if not is_kadomatu(a, b, c) or a > c: break else: return True return False DD = list(map(int, input().split())) if solve(): print('YES') else: print('NO')