D = [int(i) for i in input().split()] L = len(D) used = [False for i in range(L)] S = [-1 for i in range(L)] def dfs(n): if n == L: for i in range(L - 2): if (max(S[i:i + 2]) == S[i + 1] or min(S[i:i + 2]) == S[i + 1]) and S[i] < S[i + 2] and S[i] != S[i + 1] and S[i + 1] != S[i + 2]: return True return False for i in range(L): if used[i]: continue used[i] = True tmp = S[n] S[n] = D[i] if(dfs(n + 1)): return True used[i] = False S[n] = tmp return False if dfs(0): print('YES') else: print('NO')