main=interact(\s->unlines[[last$s!!i:[' '|i/=j,i+j/=l,2*j/=l]++[s!!j|2*i==l]|j<-[0..l]]|l<-[length s-1],i<-[0..l]])