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):
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):
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==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 h == 0 and w == 0:
        break
    
    frame = "
    dots = "
    print(frame)
    for row in range (h-2):
        print(dots)
    print(frame)
    print()

Solution (Python):
while True:
    integers = list(map(int, input().split(" ")))
    H = integers[0]
    W = integers[1]
    dot = "." * (W - 2)
    if H != 0 and W != 0:
        print("
        for i in range(1, H - 1):
            print(f'
        print("
        print("")
    else:
        break

Solution (Python):
S = list(map(int, open(0).read().split()))[:-2]
for h, w in zip(*[iter(S)]*2):
    print('
    for _ in range(h-2):
        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 j == 0 or i == 0 or i == W-1 or j == H-1:
                print('
            else :
                print(".",end = '')
        print()
    print()

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

    if h == 0 and w == 0:
        break

    
    for i in range(w):
        print('
    print()

    for a 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):
while True:
    T = list(map(int,input().split()))
    if T[0]==0 and T[1]==0:
        break

    for i in range(T[0]):
        for j in range(T[1]):
            if 0 < i and i < T[0]-1 and 0 < j and j < T[1]-1:
                print(".",end="")
            else:
                print("
        print()

    print()

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    h,w=list(map(int,input().split()))
    while (h,w)!=(0,0):
        top = "
        mid="
        print(top)
        for _ in range(h-2):
            print(mid)
        print(top)
        print()
        h,w=list(map(int,input().split()))

main()

Solution (Python):
while True:
    H,W = map(int, input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        s = ""
        flg = True
        for j in range(W):
            if i == 0:
                s = s + "
            elif i == H-1:
                s = s + "
            elif flg:
                s = s + "
                flg = False
            elif j == W-1:
                s = s + "
            else:
                s = s + "."
        print(s)
    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):
Rect = []
cnt = 0
while True:
    H, W = map(int, input().split())
    if (H, W) == (0, 0):
        break
    Rect.append((H, W))
    cnt += 1

for i in range(cnt):
    print("
    for j in range(Rect[i][0]-2):
        print("
    print("
    print()

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

            x += 1
            
        print("")
        y += 1

    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):
import sys
  
for s in sys.stdin:
    h,w = [ int(x) for x in s.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
    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):
ans = ""
for i in range(1000):
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    else:
        for j in range(H):
            if j == 0 or j == H-1:
                for _ in range(W):
                    ans += "
                print(ans)
                ans = ""
            else:
                for _ in range(W):
                    if _ == 0 or _ == W-1:
                        ans += "
                    else:
                        ans += "."
                print(ans)
                ans = ""
    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 j == 0 or j == b-1 or i == 0 or i == a -1:
                print(r"
            else:
                print(r".",end="")
        print()
    print("")

Solution (Python):
while 0 == 0:
    a,b = map(int,input().split())
    if a == b == 0:
        break
    for i in range(a):
        for j in range(b):
            if i == 0 or i == a-1 or j == 0 or j == b-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 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):
        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
    else:
        for l in range(H):
            if l == 0 or H - l == 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 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 = [int(i) for i in input().split()]
    
    if h == 0 and w == 0:
        break
    
    print("
    for _ in range(h-2):
        print("
    print("
    print("")

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

    if a == 1:
        print("
    else:
        print("
        for i in range(a - 2):
            print("
        print("
    print()

Solution (Python):
def mp(h, w) :
	str1 = ''
	for i in range(0, w):
		str1 += '
	str2 = '
	for i in range(0, w - 2):
		str2 += '.'
	str2 += '
	print(str1)
	for i in range(0, h - 2):
		print(str2)
	print(str1)
	print()




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

Solution (Python):
while True:
    l = list(map(int, input().split()))
    a,b = l[0],l[1]
    if a == 0 and b == 0:
        break
    print("
    for i in range(a-2):
        print("
    print("
    print()

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

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

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        break
    else:
        for t in range(h):
            if 0 < t < h - 1:
                for y in range(w):
                    if 0 < y < w - 1:
                        print(".",end="")
                    else:
                        print("
                print()
            else:
                for y in range(w):
                    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 or i == h-1:
            print('
        else:
            print('
      
       
    print()

Solution (Python):
judge = 1
while judge == 1:
    H, W = (int(x) for x in input().split())

    if H == 0 and W == 0:
        judge = 0
        break
    print("
    H -= 2
    while H > 0:
        print("
        print("."*(W-2), end="")
        print("
        H -= 1

    print("
    print()

Solution (Python):
import math
text=input().split()
for i,v in enumerate(text):
    text[i]=int(v)
while text[0] or text[1]:
    for i in range(text[0]):
        if i==0 or i==text[0]-1:
            print('
        else:
            print('
    text=input().split()
    print()
    for i,v in enumerate(text):
        text[i]=int(v)

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

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

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

Solution (Python):
while True:
  h,w = map(int, input().split())
  if h == 0 and w == 0:
    break
  else:
    for j in range(h):
      for i in range(w):
        if i == 0 or i == w-1 or j == 0 or j == h-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 in range(w):
        print('
    print('')
    for j in range(h-2):
        print('
        for i in range(w-2):
            print('.', end='')
        print('
    for i in range(w):
        print('
    print('')
    print('')

Solution (Python):
while True:
    H, W = map(int, input().split(' '))
    if H == W == 0:
        break
    edge = ['
    middle = ['
    box = []
    box.append(edge)
    for i in range(H-2):
        box.append(middle)
    box.append(edge)
    
    for items in box:
        print(items[0])
    print('')

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

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == w == 0:
        break
    else:
        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 True:
    nums = [int(e) for e in input().split()]
    if nums[0] == 0 and nums[1] == 0:
        break
    for i in range(nums[0]):
        if i == 0 or i == nums[0]-1:
            print("
        else:
            print("
    print ("")

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

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

Solution (Python):


def main():
    while True:
        H, W = map(int, input().split())

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

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

        print("

if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys
a = []
for l in sys.stdin:
    a.append(list(map(int,l.split())))
    
for i in a:
  if i[0]==0 and i[1]==0:
    break
  print('
  for x in range(1,i[0]-1):
    print('
  print('

  print('\r')

Solution (Python):
while True:

    W,H=list(map(int,input().split()))
    if W==0 and H==0:
        break

    for i in range(W):
        for j in range(H):
            if i==0 or i==W-1 or j==0 or j==H-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 or j == 0 or j == b -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 in range(h):
        wid=''
        if i==0 or i==h-1:
            for l in range(w):  
                wid+='
            print(wid)
        
        else :
            wid+='
            for k in range(1,w-1):
                wid+='.'
            wid+="
            print(wid)
    print("")

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        break
    l = [x for x in range(h)]
    for y in l:
        if y == l[0]:
            print('
        elif y != max(l):
            print('
        elif y == max(l):
            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 m in range(W):
            if i == 0 or i == H-1 or m == 0 or m == 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 j == 0 or i == 0 or j == H - 1 or i == W - 1 :
                print("
            
            else :
                print(".", end = "")
        print()
    print()

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    else:
        for x in range(h):
            if x == 0 or x == h - 1:
                print("
            else:
                str = ""
                for y in range(w):
                    if y == 0 or y == w - 1:
                        str += "
                    else:
                        str += "."
                print(str)
        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("{}{}{}".format("
    
        print()

Solution (Python):
while True:
    H, W = list(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:
                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
    else:
        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):
        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 j in range(H):
        for i in range(W):
            if j == 0 or j == H-1 or i == 0 or i == 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 y in range(0, H):
        for x in range(0, W):
            if x == 0 or x == W - 1 or y == 0 or y == 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
    s=""
    for _ in range(w):
        s+="
    print(s)
    last=s
    for H in range(h-2):
        s="
        for W in range(w-2):
            s+="."
        s+="
        print(s)
    print(last)
    print()

Solution (Python):
def rect(h, w):
	print('
	for _ in range(h - 2):
		print('
	print('

while True:
	h, w = map(int, input().split())
	if h == 0 & w == 0:
		break
	else:
		rect(h, w)
		print('\r')

Solution (Python):
while True:
    h,w=map(int,input().split())
    if h==0 and w==0:
        break
    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
    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

    else:
        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 == 0 and w == 0:
        break
    
    for line in range(h):
        if line in (0, h-1):
            print('
        else:
            print('
    print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if H == 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 1:
    a,b=map(int,input().split())
    if a==b==0:break
    for i in range(a):
        if i==0 or i==a-1:
            print("
        else:print("
    print()

Solution (Python):
i_nums = []
x = True
while x == True:
    i_nums.append(list(map(int, input().split())))
    if i_nums[-1][0] == i_nums[-1][1] == 0:
        x = False
i_nums.pop()

for nums in i_nums:
    for i in range(nums[0]):
        for j in range(nums[1]):
            if i == 0 or i == nums[0]-1:
                print('
            elif j == 0 or j == nums[1]-1:
                print('
            else:
                print('.', end='')
        print('')
    print('')

Solution (Python):
h, w = [int(i) for i in input().split()]
while h or w:
    for i in range(h):
        if not i or i == h - 1:
            print("
        else:
            print("
    print()
    h, w = [int(i) for i in input().split()]

Solution (Python):
import sys
while True:
    h, w = [int(i) for i in input().split()]
    if h == 0 and w == 0:
        sys.exit()
    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 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
    for i in range(H):
        if i == 0 or i == H - 1:
            print('
        else:
            print('
    print()

Solution (Python):
H,W=map(int,input().split())
while(H,W)!=(0,0):
    
    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()
    H,W=map(int,input().split())

Solution (Python):
while True:
    a,b=map(int,input().split())
    if a==0 and b==0:
        break
    else:
        print('
        for i in range (a-2):
            print("{}{}{}".format("
        print("
        print()

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

Solution (Python):
input_list = []
while True:
    pair = list(map(int, input().split(' ')))
    if pair[0] == 0 and pair[1] == 0:
        break
    input_list.append(pair)

for pair in input_list:
    h = pair[0]
    w = pair[1]
    for y in range(h):
        if y == 0 or y == h - 1:
            for x in range(w):
                print('
        else:
            for x in range(w):
                if x == 0 or x == w - 1:
                    print('
                else:
                    print('.', end='')
        print()
    print()

Solution (Python):
def main():
    h,w = map(int,input().split())
    if h*w == 0:
        return False
    for i in range(h):
        if i == 0 or i == h-1:
            print("
        else:
            print("
    print()
    return True

while main():
    pass

Solution (Python):
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
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):

x = []
while True:
    h, w = (int(y) for y in input().split())
    if h == 0 and w ==0:
        break
    x += [[h, w]]
for i in range(len(x)):
    print('
    for j in range(x[i][0] - 2):
        print('
    print('
    print('')

Solution (Python):
while True:
    ans = []
    h, w = map(int, input().split())
    if h >= 3 and w >= 3:
        for i in range(h):
            if i == 0 or i == h - 1:
                ans.append(['
            else:
                ans.append(['.'] * w)
                ans[i][0] = '
                ans[i][w - 1] = '
            ans[i] = ''.join(ans[i])
        print('\n'.join(ans) + '\n')
    elif h == 0 and w == 0:
        break

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

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

for t in li:
    h, w = t
    for i in range(0, h):
        for j in range(0, w):
            if i == 0 or i == h - 1:
                print('
            elif 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 in range(h):
        if i == 0 or i == (h - 1):
            print("
        else:
            print("
    print()

Solution (Python):
while True:
    a,b = (int(x) for x in input().split())
    if a == 0 and b == 0:
        break
    for j in range(b):
        print("
    print()
    for i in range(a-2):
        print("
        for j in range(b-2):
            print(".",end='')
        print("
        print()
    for j in range(b):
        print("
    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 i == 0 or i == h-1:
                print("
            elif 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('
    print(*['
            if i == h-3 
            else '
            for i in range(h-2)],
            sep='')
    print('

Solution (Python):


while True:
    h, w = map(int, input().split())
    if h + w == 0:
        break
    line0 = '
    line1 = '
    print(line0)
    for i in range(h - 2):
        print(line1)
    print(line0)
    print('')

Solution (Python):
def test():

	while True:
		i = list(map(int,input().split()))
	
		H = i[0]
		W = i[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 or j == 0 or j == W-1:
					print("
				else:
					print(".",end="")
			print()

		print()

if __name__ == "__main__":
	test()

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

Solution (Python):
while True:
    h,w = map(int, input().split())
    if (w + 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
    l = ''.join(['
    m = ''.join(['
    print(l)
    for i in range(h-2):
        print(m)
    print(l)
    print()

Solution (Python):
while True:
    s = input().split()
    H = int(s[0])
    W = int(s[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(".",sep="",end="") 
        print("")

    
    print("")

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

Solution (Python):
h, w = map(int, input().split())

while not (h == 0 and w == 0):
    for i in range(h):
        if i == 0 or i == h - 1:
            print("".join(['
        else:
            a = ['.' for _ in range(w)]
            a[0] = a[-1] = '
            print("".join(a))

    print("")
    
    h, w = map(int, input().split())

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

Solution (Python):
while True:
    H, W = map(int, input().split())
    x = "
    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()
    if H == 0 and W ==0 :
        break
    print()

Solution (Python):

while True:
    A = list(map(int,input().split()))
    H,W = A[0],A[1]

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

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

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

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

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

Solution (Python):
x, y = map(int, input().split())
while not(x == 0 and y == 0):
	print(y*'
	print((x-2)*(('
	print(y*'
	print()
	x, y = map(int, input().split())