Problem:
Print a Frame Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ##########
#........#
#........#
#........#
#........#
########## Input The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space. The input ends with two 0 (when both H and W are zero). Output For each dataset, print the frame made of '#' and '.'. Print a blank line after each dataset. Constraints  3 ≤ H ≤ 300  3 ≤ W ≤ 300  Sample Input 3 4
5 6
3 3
0 0 Sample Output ####
#..#
####

######
#....#
#....#
#....#
######

###
#.#
###

Solution (Python):
import sys


def main():
    while True:
        H, W = [int(i) for i in sys.stdin.readline().split()]
        if H == 0 and W == 0:
            break
        top_bottom_line = '
        insider_line = '
        for i in range(W - 1):
            top_bottom_line += '
        for i in range(W - 2):
            insider_line += '.'
        insider_line += '
        print(top_bottom_line)
        for i in range(H - 2):
            print(insider_line)
        print(top_bottom_line)
        print()
    return


if __name__ == '__main__':
    main()

Solution (Python):

while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        exit()
    else:
        print('
        for _ in range(h - 2):
            print('
        print('
        print()

Solution (Python):
while True:
    h, w=map(int, input().split())
    if h == 0 and w==0: break
    print("
    for i in range(h-2):
        print("
    print("
    print()

Solution (Python):
c=0
i = 0
h = []
w = []
while c == 0:
    a = input().split()
    if int(a[0]) == 0:
        c = 1
    elif int(a[1]) == 0:
        c = 1
    else:
        h.append(a[0])
        w.append(a[1])
        i = int(i) + 1

for j in range(int(i)):
    for k in range(int(h[j])):
        for o in range(int(w[j])):
            if int(o) == int(w[j])-1:
                print('
            elif int(o) == 0:
                print('
            elif int(k) == 0:
                print('
            elif int(k) == int(h[j])-1:
                print('
            else:
                print('.',end='')

    print('')

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0:
        break
    print("
    for i in range(H-2):
        print("
    print("

    print()

Solution (Python):
while True:
    a, b = map(int, input().split())
    if a or b:
        for i in range(0, a):
            for j in range(0, b):
                if i == 0 or i == a - 1 or j == 0 or j == b - 1:
                    print('
                else:
                    print(".", end = '')
            print()
        print()
    else:
        break

Solution (Python):
b = []
c = []
d = []
while True:
    a = input().split()
    a[0] = int(a[0])
    a[1] = int(a[1])
    if a[0] == 0 and a[1] == 0:
        break
    else:
        b.append("
        d.append("
        c.append(a[0])
for i in range(len(c)):
    print(b[i])
    for j in range(c[i]-2):
        print(d[i])
    print(b[i])
    print("\n",end="")

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H - 1:
            print('
        else:
            print('
    print('')

Solution (Python):
values = []
while True:
    value = input().split()
    if int(value[0]) == 0 and int(value[1]) == 0:
        break
    else:
        values.append(value)

for value in values:
    m = int(value[0])
    n = int(value[1])
    for i in range(m):
        row_output = ""
        for j in range(n):
            if i == 0 or i == m -1:
                row_output += "
            else:
                if j == 0 or j == n - 1:
                    row_output += "
                else:
                    row_output += "."
        print(row_output)
    print()

Solution (Python):
H=1
while H:
 H,W=map(int,raw_input().split());S="
 if H:print S+("

Solution (Python):
while True:
    w,h = map(int,input().split())
    if w == 0 and h == 0:
        break
    for i in range(w):
        if i==0 or i == w-1: print('
        else: print('
    print()

Solution (Python):
while True:
     H, W = map(int, raw_input().split())
     if H == W == 0:
         break
     for i in range(H):
         if i == 0 or i == H -1:
             print "
         else:
             print "
     print

Solution (Python):

lst = []
while True:
    h, w = map(int, input().split())
    lst.append([h, w])
    if h == 0 and w == 0:
        break
for l in lst:
    H = l[0]
    W = l[1]
    for i in range(H):
        for j in range(W):
            if i == 0 or i == H-1:
                print ('
            else:
                if j == 0 or j == W-1:
                    print ('
                else:
                    print ('.', end = '')
        print ('')
    if i == H-1:
        print ('')

Solution (Python):
ans = []

def paint(h, w):
    a = []
    for i in range(h):
        if i == 0 or i == h - 1:
            a.append("
        else:
            a.append("
    ans.append("\n".join(a))

while True:
    H, W = map(int, input().split())
    if H == W == 0: break

    paint(H, W)

print(("\n" * 2).join(ans), "\n", sep = "")

Solution (Python):
while True:
    h, w = map(int, input().split())
    if(w == h == 0): break
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h - 1:
                print('
            else:
                if j == 0 or j == w - 1:
                    print('
                else:
                    print('.', end = '')
        print('')
    print('')

Solution (Python):
while True:
    h, w = map(int, input().split())
    if w+h == 0:
        break
    line = ""
    for y in range(h):
        if y == 0 or y == h-1:
            line = "
        else:
            line = "
        print(line)
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H-1:
            print("
        else:
            print("
    print()

Solution (Python):
while True:
    h, w = [int(i) for i in input().split(' ')]
    if h ==0 and w ==0:
        break
    for i in range(h):
        row = ''
        for j in range(w):
            if i == 0 or i == h - 1:
                row = row + '
            else:
                if j == 0 or j == w -1:
                    row = row + '
                else:
                    row = row + '.'
        print(row)
    print('')

Solution (Python):
while True:
	H, W = map(int, input().split())
	if H == 0 and W == 0:
		break
	print("
	for i in range(H - 2):
		print("
	print("
	print()

Solution (Python):
while True:
    s=input().split()
    t=[int(i) for i in s]
    H=t[0]
    W=t[1]
    if H==0:
        break
    else:
        print("
        for i in range(H-2):
            print("
        print("
        print()

Solution (Python):
if __name__ == '__main__':
    while True:
        data = [int(x) for x in input().split(' ')]
        H = data[0]
        W = data[1]

        if H == 0 and W == 0:
            break

        for i in range(H):
            if i == 0 or i == H-1:
                print('
            else:
                print('
        print('')

Solution (Python):
while 1:
    h,w=map(int,input().split())
    if h==0 and w==0: 
        break
    for y in range(h): 
        if y == 0 or y == h-1:
            print('
        else: 
            print('
    print('')

Solution (Python):
while True:
    H,W = map(int,input().split())
    
    if H == W == 0:
        break
    
    for i in range(H):
        if i == 0 or i == H-1:
            print('
        else:
            print('
    print('')

Solution (Python):
while True:
    H,W = map(int,input().split())
    
    if H == W == 0:
        break
    
    for i in range(H):
        if i == 0 or i == H-1:
            print('
        else:
            print('
    print('')

Solution (Python):
while True:
    h,w=map(int,input().split())
    if h==0 and w==0:
        break
    for i in range(h):
        for j in range(w):
            if i==0 or j==0 or i==h-1 or j==w-1:
                print("
            else:
                print(".",end="")
        print("")
    print("")

Solution (Python):
ans = []
add = ans.append
for line in open(0).readlines():
    H, W = map(int, line.split())
    if not H:
        break
    r = "
    add(r)
    add(("
    add(r)
    add("\n")
open(1, 'w').writelines(ans)

Solution (Python):
while True:
    a, b = map(int, input().split())
    if(a == 0 and b == 0):
        break
    for i in range(a):
        for j in range(b):
            if(0 < i < a-1 and 0 < j < b-1):
                print(".", end = "")
            else:
                print("
        print()
    print()

Solution (Python):
while (True):
    s = list(map(int, input().strip().split(' ')))

    if s[0] == 0 and s[1] == 0:
        break
    else:
        for i in range(s[0]):
            for j in range(s[1]):
                if i == 0 or i == s[0] - 1:
                    print("
                elif j == 0 or j == s[1] - 1:
                    print("
                else:
                    print(".",end="")
            print()
    print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if H==0 and W==0:
        break
    print("
    for i in range(H-2):
        print("
    print("
    print()

Solution (Python):
import sys


h, w = map(int, input().split())
while h != 0:
    print("
    for _ in range(h-2):
        for i in range(w):
            if i == 0 or i == w-1:
                sys.stdout.write("
            else:
                sys.stdout.write(".")
        print()
    print("
    print()
    h, w = map(int, input().split())

Solution (Python):
from sys import stdin

while True:
    H, W = [int(x) for x in stdin.readline().rstrip().split()]
    if H == 0 and W == 0:
        break
    else:
        print("
        for i in range(H-2):
            print("
        else:
            print("

Solution (Python):


while(1):
    H,W=map(int,input().split(" "))
    if H==0 and W==0:
        break
    for i in range(H):
        for j in range(W):
            if i==0 or i==H-1 or j==0 or j==W-1:
                print("
            else:
                print(".",end="")
        print()
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i, h in enumerate((range(H - 1))):
        if i == 0:
            print('
        else:
            print('
    print('
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for j in range(W):
            if i == 0 or i == (H - 1) or j == 0 or j == (W - 1):
                print('
            else:
                print('.', end='')
        print()
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())

    if H == 0 and W == 0:
        break

    print('
    for _ in range(H-2):
        print('
    print('
    print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    for i in range(h):
        if i == 0:
            print('
        elif i == h-1:
            print('
        else:
            print('
    print()

Solution (Python):
while True:
    H,W = [int(i) for i in input().split()]
    if H == 0 and W == 0:
        break
    else:
        for line in list(range(1,H+1,1)):
            for column in list(range(1,W+1,1)):
                if line == 1 or line == H:
                    if column == W:
                        print("
                    else:
                        print("

                else:
                    if column == 1:
                        print("
                    elif column == W:
                        print("
                    else:
                        print(".", end = "")
        print("")

Solution (Python):
while (1):
    h, w = map(int, input().split())
    if (h == 0) and (w == 0):
        break
    print("
    for i in range(h - 2):
        print("
    print("
    print()

Solution (Python):
while(1):
    h,w = [int(i) for i in input().split()]
    if h == 0 and w == 0:
        break
    print("
    for i in range(h-2):
        print("
    print("
    print("")

Solution (Python):
while True:
    i = list(map(int, input().split()))
    if i[0] == 0 and i[1] == 0:
        break
    else:
        for j in range(i[0]):
            for k in range(i[1]):
                if j == 0 or j == i[0]-1:
                    print("
                elif k == 0 or k == i[1]-1:
                    print("
                else:
                    print(".", end='')
            print("\n", end='')
        print("\n", end='')

Solution (Python):
while True:
  a, b = map(int, input().split())
  if a == b == 0:
    break

  for i in range(a):
    if i == 0 or i == a - 1:
      print('
      continue
    print('

  print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print("
    for i in range(H-2):
        if i != 0 or i != H-1:
            print("
    print("
    print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if H==W==0:
        break;
    print("
    for i in range(0,H-2):
        print("
    print("
    print()

Solution (Python):
while True:
    h,w=map(int,input().split())
    if(h==0):
        break
    for i in range(h):
        if i==0 or i==h-1:
            for j in range(w):
                print("
            print()
        else:
            for j in range(w):
                if j==0 or j==w-1:
                    print("
                else:
                    print(".",end="")
            print()
    print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if H==W==0:
        break;
    print("
    for i in range(0,H-2):
        print("
    print("
    print()

Solution (Python):
while True:	
	H,W = map(int, input().split())
	if H==0 and W==0: break
	for y in range(0,H):
		for x in range(0,W):
			if y==0 or y==H-1: print("
			else:
				if x == 0 or x==W-1: print("
				else: print(".",end="")
		print()
	print()

Solution (Python):
while True:
    line = input()
    data = line.split()
    h = int(data[0])
    w = int(data[1])
    if h == 0 and w == 0:
        break

    for i in range(h):   
        for j in range(w):
            if i == 0 or i == h -1:
                print("
            else:
                if j == 0 or j == w -1:
                    print("
                else:
                    print(".", end="")
        print("")
    print("")

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == W == 0:
        break
    print('
    for _ in range(H-2):
        print('
    print('

Solution (Python):
while True:
    H,W = (int(x) for x in input().split())
    
    if H == 0 and W == 0:
        break

    for i in range(H):
        for j in range(W):
            if (j == 0 or j == W-1) or (i == 0 or i == H-1):
                print ('
            else:
                print ('.', end='')
        print ('')
    print ('')

Solution (Python):
while 1:
    h,w=map(int,input().split())
    if h==0 and w==0: break
    for i in range(h):
        if i==0 or i==h-1: print('
        else: print('
    print()

Solution (Python):
for i in range(10000):
  x = input().split()
  h = int(x[0])
  w = int(x[1])
  if h == 0 and w ==0:
    break
  for i in range(w):
    print("
  print()  
  for i in range(h-2):
    print("
    for i in range(w-2):
      print(".",end="")
    print("
    print()
  for i in range(w):
    print("
  print()
  print()

Solution (Python):
for i in range(10000):
  x = input().split()
  h = int(x[0])
  w = int(x[1])
  if h == 0 and w ==0:
    break
  for i in range(w):
    print("
  print()  
  for i in range(h-2):
    print("
    for i in range(w-2):
      print(".",end="")
    print("
    print()
  for i in range(w):
    print("
  print()
  print()

Solution (Python):
put = '
put2 = '.'
output = []
while True:
	data = list(map(int, input().split()))
	if data[0] == 0 and data[1] == 0:
		break
	output += [data]

for tmp in output:
	for h in range(tmp[0]):
		for w in range(tmp[1]):
			if h == 0 or h == tmp[0]-1 or w == 0 or w == tmp[1]-1:
				print(put, end="")
			else:
				print(put2, end="")
		print()
	print()

Solution (Python):
while True :
	H, W = map(int, input().split())
	if(H == 0 & W == 0) :
		break
	else :
		for i in range(H) :
			for j in range(W) :
				if(i == 0 or i == H - 1 or
				j == 0 or j == W - 1) :
					print("
				else :
					print(".", end = "")
			print()
		print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    width = ''
    for j in range(h):
        if j == 0 or j == h - 1:
            for i in range(w):
                width += '
        else:
            for i in range(w):
                if i == 0 or i == w - 1:
                    width += '
                else:
                    width += '.'
        print(width)
        width = ''
    print('')

Solution (Python):
while(True):
    h, w = map(int, input().split())
    if(h == 0 and w == 0):
        break
    print('
    for _ in range(h - 2):
        print('
    print('
    print()

Solution (Python):
c = []

def listcreate():
    global c
    c = []
    for y in range(a[0]):
        b = []
        for x in range(a[1]):
            if y == 0 or y == a[0]-1 or x == 0 or x == a[1]-1:
                b.append("
            else:
                b.append(".")
        c.append(b)
    return

def listdraw():
    global c
    for y in range(len(c)):
        for x in range(len(c[0])):
            print(c[y][x], end='')
        print()
    return

for i in range(10000):
    a = list(map(int,input().split()))
    if sum(a)==0:
        break
    listcreate()
    listdraw()
    print()

Solution (Python):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    for n in range(a):
        if n == 0 or n == a - 1:
            print("
        else:
            print("
    print("")

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break

    print("
    for _ in range(h-2):
            print("

    print("
    print()

Solution (Python):
while True:
    h,w = map(int, input().split())
    if h == 0 and w == 0:
        break
    else:
        for i in range(h):
            if i == 0 or i == h-1:
                print("
            else:
                print("
    print()

Solution (Python):
while True :
  H,W = map(int,input().split())
  if W == 0 and H == 0 :
    break
  for i in range(H) : 
      if i == 0 or i == H-1 :       
        print('
      else  :
        print('
  print('')

Solution (Python):
lines = []
colums = []

while True:
  H,W = map(int,input().split())
  if H == 0 and W == 0:
    break
  lines.append(H)
  colums.append(W)

for H,W in zip(lines,colums):
  for i in range(H):
    if i == 0 or i == H-1:
      for j in range(W):
        print("
    else:
      for j in range(W):
        if 0 < j and j < W-1:
          print(".",end="")
        else:
          print("
    print("\n",end="")
  print("\n",end="")

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    else:
        for i in range(h):
            for j in range(w):
                if j == 0 or j == w-1:
                    print("
                else:
                    if i == 0 or i == h-1:
                        print("
                    else:
                        print(".",end="")
            print()
        print()

Solution (Python):
Flag = True
data = []
while Flag:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        Flag = False
    else:
      data.append((H, W))

for (H, W) in data:
    for i in range(H):
        if i == 0 or i == H-1:
            print('
        else:
            print('
    print('\n', end="")

Solution (Python):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    else:
        for i, _ in enumerate(range(a)):
            if i == 0 or i == (a - 1):
                x = '
                print(x)
            else:
                print('
        print()

Solution (Python):
a, b = map(int,input().split())
while a != 0:
    print('
    for i in range(a-2):
        print('
    print('
    print()
    a, b = map(int,input().split())

Solution (Python):
while True:
    H,W = [int(x) for x in input().split()]
    if (H,W)==(0,0): break
    for i in range(H):
        if i==0 or i==H-1:
            print("
        else:
            print("
    print("")

Solution (Python):
while 1:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    print('
    for i in range(H-2):
        print('
    print('
    print('')

Solution (Python):
while 1:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    print('
    for i in range(H-2):
        print('
    print('
    print('')

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print("
    for i in range(H - 2):
        print("
    print("
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print("
    for i in range(H - 2):
        print("
    print("
    print()

Solution (Python):
while True:
  H,W = [int(x) for x in input().split()]
  if (H,W)==(0,0): break
  for i in range(H):
      if i==0 or i==H-1:
          print("
      else:
          print("
  print("")

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    print("
    for i in range(H - 2):
        print("
    print("
    print()

Solution (Python):
while True:
  H,W = map(int, input().split())
  if H == 0 and W == 0:
    break
  print("

  for i in range(H-2):
    print("
    
  print("

Solution (Python):
while True:
  H,W = map(int, input().split())
  if H == 0 and W == 0:
    break
  print('
  for i in range(H-2):
    print('
  print('
  print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0:
        break
    print("
    for i in range(H-2):
        print("
    print("
 
    print()

Solution (Python):
while True:
 
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if i == 0 or i == H-1 or k == 0 or k == W-1:
                print("
            else:
                print(".",end = "")
        print()
 
    print()

Solution (Python):
while True:
  H , W = map(int,input().split())
  if H == 0 and W == 0:
    break
  print('
  for i in range(H-2):
    print('
  print('
  print()

Solution (Python):
BIG_NUM = 2000000000
 
while True:
 
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if i == 0 or i == H-1 or k == 0 or k == W-1:
                print("
            else:
                print(".",end = "")
        print()
 
    print()

Solution (Python):
while True:
    a,b= map(int,input().split())
    if(a==0 and b==0):
        break;
    for i in range(a):
        for j in range(b):
            if( i == 0 or i == a-1):
                print('
            elif(j == 0):
                    print('
            elif(j > 0 and j < b-1):
                    print('.',end='')
            elif(j==b-1):
                    print('
        print()
    print()

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h==0 and w==0:
        break
    else:
        for i in range(h):
            if i == 0 or i== h-1:
                print('
            else:
                print('
    print('')

Solution (Python):
from sys import stdin

while True:
    h, w = (int(n) for n in stdin.readline().rstrip().split())
    if h == w == 0:
        break

    for n in range(h):
        if n in {0, h - 1}:
            print('
            continue

        print('

    print()

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    for x in range(h):
        if x == range(h)[0] or x == range(h)[-1]:
                print(w*"
        else:
            for y in range(w):
                if y == range(w)[0] or y == range(w)[-1]:
                    print("
                else:
                    print(".",end="")
        print()
    print()

Solution (Python):
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  for j in range(H):
    for i in range(W):
      if i == 0 or j == 0 or i == W-1 or j == H-1:
        print('
      else:
        print('.', end="")
    print()
  print()

Solution (Python):
while True:
    num = list(map(int,input().split()))
    if(num[0] == 0 and num[1] == 0): break
    else:
        flag = False
        for i in range(num[0]):
            str = ""
            if(i == 0 or i == num[0]-1): flag=True
            else: flag=False
            for j in range(num[1]):
                if(j == 0 or j == num[1]-1 or flag):
                    str = str + "
                else:
                    str = str + "."
            print(str)
        print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if H == 0:
        break
    print('
    for i in range(H-2):
       print('
    
    print('

    print()

Solution (Python):
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  print('
  for i in range(1,H-1):
    print('
    for j in range(1,W-1):
      print('.', end='')
    print('
  print('
  print()

Solution (Python):
ans=[]

while True:
    H,W=map(int,input().split())
    if W==H==0:
        break
    r=''
    r+='

    for i in range(H-2):
        r+='

    r+='
    ans.append(r)

print('\n'.join(ans))

Solution (Python):
while True:
  H,W=map(int,input().split())
  if H==0 and W==0: break
  for i in range(0,H):
    if i==0 or i==H-1:
      print("
    else:
      print("
  print()

Solution (Python):
while True:
  H, W = map(int,input().split())
  if H == 0 and W == 0:
    break
  print('
  for i in range(1,H-1):
    print('
    for j in range(1,W-1):
      print('.', end='')
    print('
  print('
  print()

Solution (Python):
while True:
    H,W = map(int, input().split())
    if H == W == 0: break
    print("
    print(("
    print("

Solution (Python):
while True:
  H, W = map(int, input().split())
  if H == 0 and W == 0:
    break
  print('
  for i in range(1, H-1):
    print('
    for j in range(1, W-1):
      print('.', end ='')
    print('
  print('
  print()

Solution (Python):
while True:
  H, W = map(int, input(). split())
  if H == 0 and W == 0:
    break
  print('
  for i in range(1, H-1):
    print('
    for j in range(1, W-1):
      print('.', end='')
    print('
  print('
  print()

Solution (Python):
def az13():
    while True:
        xs = raw_input().split()
        H,W = int(xs[0]),int(xs[1]) 
        if H==0 and W==0 : break
        for i in range(0,H):
            if i == 0 or i == H-1 :
                print "
            else :
                print "
        print

az13()

Solution (Python):
while True:
    [H,W] = raw_input().split()
    H = int(H)
    W = int(W)
    if H == 0 and W == 0:
        break

    for y in range(0,H):
        s = ''
        for x in range(0,W):
            c = '.'
            if x == 0 or x == W - 1:
                c = '
            if y == 0 or y == H - 1:
                c = '
            
            s = s + c
        
        print s
    print ''

Solution (Python):
while True:
    H, W = map(int, raw_input().split())
    if H == 0 and W == 0:
        break
    print("
    for i in range(1, H - 1):
        print("
    if H != 1:
        print("
    print("")

Solution (Python):
while True:
    a = list(map(lambda x : int(x), input().split(" ")))
    if a[0] == 0 and a[1] == 0:
        break

    for i,i_ in enumerate(range(a[0])):
        for j,j_ in enumerate(range(a[1])):
            if i == 0 or i == a[0] - 1 or j == 0 or j == a[1] - 1:
                print("
            else:
                print(".", end="")
        print()
    print()

Solution (Python):
while 1:
    h,w=map(int,raw_input().split())
    if h==w==0:break
    print '
    for i in range(h-2):
        if w>=2:
            print '
        else :
            print '
    print '
    print''

Solution (Python):
while 1:
  h,w=map(int,raw_input().split())
  if h==0:exit()
  print'
  for i in range(h-2):print'
  print'
  print

Solution (Python):
while 1:
	H , W = map(int , raw_input().split())
	if H == 0 and W == 0:
		break
	print "
	for h in range(0,H-2):
		s = "
		for l in range(0,W-2):
			s += "."
		s += "
		print s

	print "
	print

Solution (Python):
while True:
	H,W = map(int, raw_input().split(" "))
	if H == 0 and W == 0:
		break
	else:
		for h in xrange(H):
			if h == 0 or h == H - 1:
				print "
			else:
				print "
		print ""

Solution (Python):
while True:
    try:
        (h,w)=map(int,raw_input().split())
        if h==0 and w==0: break
        for i in xrange(h):
            if i==0 or i==h-1:
                print ''.join(['
            else:
                print '
        print
    except EOFError: break

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == w == 0: break
    print('
    print('')

Solution (Python):
import sys
line = sys.stdin.readline()
while line:
	H,W = map(int,line.split())
	if H == 0 and W == 0:
		break;
	print "
	for i in range(0,H-2):
		print "
	print "
	print ""
	line = sys.stdin.readline()

Solution (Python):
def frame(h,w):
    m,b,p = "
    return m*w+b + (m+p*(w-2)+m+b)*(h-2) + m*w+b

while 1:
    h,w=map(int,raw_input().split())
    if h==w==0:break
    print frame(h,w)

Solution (Python):
def frame(h,w):
    m,b,p = "
    print m*w+b + (m+p*(w-2)+m+b)*(h-2) + m*w+b

while 1:
    h,w=map(int,raw_input().split())
    if h==w==0:break
    frame(h,w)

Solution (Python):
while True:
    h,w = map(int,raw_input().split())
    if h == 0 and w == 0:
        break
    print "
    for a in range(h-2):
        print "
    print "
    print ""

Solution (Python):
import sys
while 1:
	H, W = map(int, raw_input().split())
	if H == 0 and W == 0:
		break
	else:
		for h in range(0, H):
			for w in range(0, W):
				if h == 0 or h == H - 1 or w == 0 or w == W -1:
					sys.stdout.write("
				else:
					sys.stdout.write(".")
			print ""
		print ""

Solution (Python):
while True:
    h,w = tuple([int(x) for x in raw_input().split(" ")])
    if h==0 and w==0: break

    for ih in range(h):
        if ih==0 or ih==h-1 or w <= 2: print "
        else: print "

    print ""

Solution (Python):
import sys
for line in sys.stdin:
    H, W = map(int, line.split())
    if H == W == 0:
        break
    print('
    print(('
    print('
    print()

Solution (Python):
h,w = [],[]
while True:
    (h,w) = [int(x) for x in input().split()]
    if h == w == 0:
        break
    for x in range(h):
        for y in range(w):
            if x == 0 or y == 0 or x == h-1 or y == w-1:
                print('
            else:
                print('.', end='')
        print()
    print()

Solution (Python):
while True:
    (H, W) = [int(x) for x in input().split()]
    if H == W == 0:
        break

    for hc in range(H):
        for wc in range(W):
            if hc == 0 or hc == H - 1:
                print('
            else:
                print('

        print()

    print()