print((function (f, s) local h,t={},0 for i=1,13 do local c=f(s,i,i) if h[c]==nil then h[c],t=0,t+1 end h[c]=h[c]+1 if h[c]>2 or t>7 then return "Impossible" end end for k,v in pairs(h) do if v==1 then return k end end end)(string.sub, io.stdin:read("*l")))