puts ("1\n"..gets).map{n=gets.to_i
n<2?"#\n":n<3?"##\n# \n":(a=[?#*n+?\n]+(2..n).map{?#+" "*(n-2)+"#\n"}
c=i=j=n-1
d=[[1,0],[0,-1],[-1,0],[0,1]]
(c=0;(x,y),_=d.rotate!;(c+=1;a[i+=x][j+=y]=?#)while a[i+x*2][j+y*2]<?#)while c>1
a*"")}*?\n