from collections import Counter def main(): S = input() hand_counter = Counter(S) hand_comb = hand_counter.most_common(7) if len(hand_comb) != 7: print("Impossible") return if all(hand_comb[idx][1] == 2 for idx in range(6)) and hand_comb[-1][1] == 1: print(hand_comb[-1][0]) else: print("Impossible") if __name__ == "__main__": main()