from collections import Counter values, counts = zip(*Counter(list(input())).most_common()) if list(counts) == [2] * 6 + [1]: print(values[-1]) else: print("Impossible")