n=[]
while (a=gets)!=nil
n<< a.split.map(&:to_i)
end
n.each{|e|
exit if e[0]==e[1]&&e[0]==0
now=1
loop do
case now
when 1;puts "#"*e[1];now+=1
when e[0];puts "#"*e[1];break
else;_= Array.new(e[1]-2,".").join;puts "#"+_+"#";now+=1
end
end
puts
}
