S = raw_input() hand = [] for i in range(0, 13): hand.append(S[i]) hand.sort() letter = [] lettercount = [] tmp = '' for i in range(0, 13): if hand[i] == tmp: lettercount[-1] += 1 else: letter.append(hand[i]) lettercount.append(1) tmp = hand[i] if len(letter) != 7: print 'Impossible' else: notpair = '' for i in range(0, 7): if lettercount[i] > 2: print 'Impossible' break if lettercount[i] == 1: if notpair != '': print 'Impossible' break notpair = letter[i] if i == 6: print notpair