S=list(input()) print('Impossible' if len([x for x in set(S) if S.count(x)==2])!=6 else [x for x in set(S) if S.count(x)<2][0])