from itertools import permutations as perm def iskadomatsu(a,b,c): return a < c and (a > b and c > b or b > a and b > c) D = map(int,raw_input().split()) for P in perm(D,7): if all(iskadomatsu(*P[i:i+3]) for i in xrange(5)): print "YES" break else: print "NO"