D = list(map(int,input().split())) from itertools import permutations def is_ok(X): for i in range(1,6): T = X[i-1:i+2] if len(set(T)) !=3: return False if (T[1]==min(T) or T[1] == max(T)) and T[0]