#!/usr/bin/env python3 # -*- coding: utf-8 -*- import array import itertools def is_inc_kado_seq(seq): cond0 = len(seq) == 3 cond1 = len(set(seq)) == 3 cond2 = seq[1] == max(seq) or seq[1] == min(seq) cond3 = seq[0] < seq[2] return cond0 and cond1 and cond2 and cond3 def is_inc_kado_seq_seq(seq): n = len(seq) for i in range(n - 2): if not is_inc_kado_seq(seq[i: i + 3]): return False else: return True def can_create_inc_kado_seq_seq(seq): for cand in itertools.permutations(seq): if is_inc_kado_seq_seq(cand): return True else: return False def main(): seq = array.array("B", map(int, input().split())) print("YES" if can_create_inc_kado_seq_seq(seq) else "NO") if __name__ == '__main__': main()