main=readLn>>=mapM putStrLn.(f[""]!!) f x=x:f[a:z|a<-".#",z<-x]