loop do
  a = gets.split.map(&:to_i)
  ans = ""
  break if a[0] == 0 && a[1] == 0
  for i in 0...a[1] do
    ans << "#"
  end
  puts ans
  ans = ""
  ans << "#"
  for i in 2...a[1] do
    ans << "."
  end
  ans << "#"
  for j in 2...a[0] do
    puts ans
  end
  ans = ""
  for i in 0...a[1] do
    ans << "#"
  end
  puts ans
  puts ""
end