n,l=io.read("*l","*l")for i=1,n do b=""for k=1,#l do t=l:sub(k,k) if i==1 or i==n+0 then p=t else p=" " end b=b..t..p:rep(n-2)..t end print(b)end