from collections import Counter c1 = Counter(input()) c2 = Counter(c1.values()) if c2[2] == 6 and c2[1] == 1: print(c1.most_common()[-1][0]) else: print('Impossible')