main=interact$unlines.f.lines f t=filter(""/=)[h[lookup(x,80-y)[((x+x+y+y,x-y),c)|(y,s)<-z t,(x,c)<-z s]|x<-n]|y<-n] h s|all(Nothing==)s="" h(c:s)=maybe ' 'id c:h s n=[0..120] z=zip n