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):
list = []
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    list.append([H, W])


for i in range(len(list)):
    for j in range(list[i][0]):
        if j == 0:
            print(list[i][1]*'
        
        elif j == list[i][0]-1:
            print(list[i][1]*'
        
        else:
            print('
    
    print('')

Solution (Python):
while True:
    line = list(map(int,input().split()))
    Vertical = line[0]
    Horizontal = line[1]
    if Vertical ==0:
        break
    print("
    for i in range(line[0]-2):
        print("
        print("."* (line[1]-2),end="" )
        print("
    print("
    print()

Solution (Python):
h, w = map(int, input().split())
while h != 0 or w != 0:
    print("
    h -= 2
    while h >= 1:
        print("
        h -= 1
    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:
        s = "
        t = "."*(b-2)
        print(s)
        for i in range(a-2):
            print(f"
        print(s)
        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:
    W, H = list(map(int, input().split()))
    if W == 0 and H == 0:
        break
    n = 0
    while n <= W-1:
        if n == 0 or n == W-1:
            print("
        else:
            print("
        n += 1
    print("")

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

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

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

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

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

    else:
        c = 1
        h = H
        while h > 0:
            if c == 1 or c == H:
                print("
            else:
                s = "."*(W-2)
                print("
            h -= 1
            c += 1
                
    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 True:
  x, y = map(int, input().split())
  if x == 0 and y == 0:
      break
  for i in range(x):
    if i == 0 or i==x-1:
      print('
    else:
      print('

  print('')

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

Solution (Python):
import sys
for e in sys.stdin:
    H, W = map(int,e.split())
    if H == 0 and W == 0:
        break
    else:
        l = ["
        l2 = ["
        for i in range(H):
            if i == 0 or i == H-1:
                print("".join(l))
            else:
                print("".join(l2))
            
        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 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 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 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 W == H == 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="")
            j += 1
        print()
        i += 1
    print()

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

data_list = []
while True:
    H, W = map(int, input().split())
    if not H and not W:
        break
    data_list.append([H, W])

for data in data_list:
    for x in range(data[0]):
        if x == 0 or x == data[0] - 1:
            print('
        else:
            for y in range(data[1]):
                if y == 0:
                    print('
                elif y == data[1] - 1:
                    print('
                else:
                    print('.', end='')
    print('')

Solution (Python):
H = []
W = []
for _ in range(300):
  _h, _w = map(int, input().split())
  if _h == 0 and _w == 0:
    break
  else:
    H.append(_h)
    W.append(_w)

for i in range(len(H)):
    for j in range(H[i]):
        dash = ""
        for k in range(W[i]):
            if j == 0 or j == H[i]-1 or k == 0 or k == W[i]-1:
                dash = dash + '
            else:
                dash = dash + "."
        print(dash)
    print('')

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

    if a == 0 and b == 0:
        break
    else:
        for i in range(a):
            if i == 0 or i == a - 1:
                print('
            else:
                print('
    print()

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

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

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

    for h in range(H):
        for w in range(W):
            if h == 0 or h == H - 1:
                print('
            elif w == 0 or w == 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=input().split()
    H,W=[int(H),int(W)]
    if H==0 and W==0:
        break
    for i in range (0,H):
        if i==0 or i==H-1:
            a=""
            for j in range(0,W):
                a=a+"
            print (a)
        else :
            a=""
            for j in range(0,W):
                if j==0 or j==W-1:
                    a=a+"
                else :
                    a=a+"."
            print (a)
    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:
        print('
        for _ in range(h-2):
            print('
        print('
        print('')

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

Solution (Python):
h = 0
w = 0
listh = []
listw = []
count = 0

while(True):
    h, w = map(int,input().split())
    if h ==0 and w == 0:
        break
    listh.append(h)
    listw.append(w)
    count += 1

for i in range(count):
    str = ''
    for h in range(listh[i]):
        if h == 0 or h == listh[i]-1:
            for w in range(listw[i]):
                str += '
            print(str)
            str = ''
        else:
            for w in range(listw[i]):
                if w == 0 or w == listw[i]-1:
                    str += '
                else:
                    str += '.'
            print(str)
            str = ''

    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
    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==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 1:
    H,W = map(int,input().split())
    if H == 0 and W == 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
    else:
        for i in range(h):
            for ii in range(w):
                if i == 0 or i == h-1:
                    print("
                elif ii == 0 or ii == w-1:
                    print("
                else:
                    print(".", end="")
            print()
        print()

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

Solution (Python):
def write(H, W):
    for i in range(H):
        if i==0 or i==H-1:
            print('
        else:
            print('
            

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

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

Solution (Python):
a = []
for i in iter(input, '0 0'):
    a.append(list(map(int, i.split())))
for i in range(len(a)):
    for j in range(a[i][0]):
        if (j == 0) | (j == a[i][0]-1):
            for k in range(a[i][1]):
                print('
            print()
        else:
            for k in range(a[i][1]):
                if (k== 0) | (k == a[i][1]-1):
                    print('
                else:
                    print('.', end='')
            print()
    print()

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        exit ()
    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 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 i in range(H-2):
        print("
    print('
    print()

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

for h, w in hw:
    print('
    for hi in range(2, h):
        print(''.join(['
    print('
    print('')

Solution (Python):

while True:
    n = list(map(int,input().split()))
    if n[0] == 0:
        break
    for i in range(n[0]):
        if i == 0 or i == n[0]-1:
            print("
        else:
            print("
    print()

Solution (Python):
import math
import copy
from copy import deepcopy
import sys
import fractions

from functools import reduce

import decimal
import heapq
import collections
import itertools
sys.setrecursionlimit(100001)






def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList




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

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

Solution (Python):
while True:
  s = input().rstrip().split(' ')
  H = int(s[0])
  W = int(s[1])
  if H == 0 and W == 0:
    break;
  ans = ""
  anscen = ""
  for i in range(W):
    ans += "
  anscen += "
  for k in range(W-2):
    anscen += "."
  anscen += "
  print(ans)
  for j in range(H-2):
    print(anscen)
  print(ans)
  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 w==0 and h==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 i in range(H-2):
        print("
    
    print("
    print()

Solution (Python):

while True:
    ta,yo = map(int,input().split())
    if ta == yo == 0:
        break
    
    for tate in range(ta):
        for yoko in range(yo):
            if tate == 0 or tate == ta-1 or yoko == 0 or yoko == yo-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 h_size in range(H):
            for w_size in range(W): 
                if h_size == 0 or h_size == H-1:
                    print("
                elif w_size == 0 or w_size == W-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 j in range(w):
        print("

    print()

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

Solution (Python):
ans = []

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

    ans.append('
        ('
        '

for i, l in enumerate(ans):
    print(l)

Solution (Python):
h, w = 1, 1
dataset = []
while not(h == w == 0):
    h, w = map(int, input().split())
    dataset.append([h, w])
for n, data in enumerate(dataset):
    h, w = data[0], data[1]
    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("
        print("")
    if n!=len(dataset)-1:
        print("")

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

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == 0 and w == 0:
        exit()
    ans = ["
    ans += ["
    ans += ["
    print(*ans, sep="\n")
    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:
        break
    print("
    for i in range(H-2):
        print("
    print("

    print()

Solution (Python):
while True:
    H, W = [int(n) for n in 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(f"
    print()

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

    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:
    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 = list(map(int, input().split()))
    if W == 0 and H == 0:
        break
    w = 0
    h = 0
    for h in range(H):
        if h > 0 and h < H - 1:
            for w in range(W):
                if w > 0 and w < W - 1:
                    print(".", end="")
                else:
                    print("
            print()
        else:
            for w in range(W):
                print("
            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:
    a,b = map(int,input().split())
    if a == 0 and b == 0: break
    for i in range(1,a+1):
        for j in range(1,b+1):
            if i == 1 or i == a:
                if j == b:
                    print('
                else:
                    print('
            else:
                if 2 <= j and j != b:
                    print('.', end="")
                elif j == b:
                    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):
        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 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: 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 h in range(H):
        for w in range(W):
            if h==0 or h==(H-1) or w==0 or w==(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(h):
    for x in range(w):
      if y!=0 and y!=h-1 and x!=0 and x!=w-1:
        print(".",end="")
      else:
        print("
    print()
  print()

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

while h != 0 or w != 0:
    print("
    for i in range(h - 2):
        print("
    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
    
    for i in range(a):
        for j in range(b):
            if i == 0 or j == 0 or j == b-1 or i == a-1:
                print("
            else:
                print(".",end="")
                
        print()
    print()

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

Solution (Python):
while True:
    input_value = input()

    height, width = map(int, input_value.split())

    if height == 0 and width == 0:
        break

    edge = ''.join(['
    middle = ''.join(['

    frame = '\n'.join([edge] + [middle] * (height - 2) + [edge])

    print(frame)
    print()

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

Solution (Python):
count = 0
data = []
while True:
  count += 1
  h, x = map(int,(input().split()))
  data.append([h, x])
  if x == 0 and h == 0:
    break
for i in range(count-1):
  h, x = data[i]
  for j in range(h):
    if 0 < j < (h-1):
      print("
    else:
      print("
  print("")

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

Solution (Python):
import sys

def sa(Type= int):
  return [Type(x) for x in input().split()]

def solve(h, w):
  row = ['.']*w
  row[0] = '
  row[-1] = '
  row = ''.join(row)

  frame = [row]*h
  frame[0] = '
  frame[-1] = '

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

if __name__ == '__main__':
  

  while True:
    h, w = sa()

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

    solve(h, w)

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:
	x=list(map(int,input().split()))
	if x[0]==0 and x[1]==0:
		break
	else:
		print('
		for i in range(x[0]-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("{}{}{}".format("
    print("
    print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if H==W==0:
        exit()
    print("
    for i in range(H - 2):
        print("
        print("."*(W-2),end='')
        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("%s%s%s" %("

    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):
while True:
    H, W = list(map(int, input().split()))
    if H == 0 and W == 0:
        break
    else:
        for i in range(H):
            for j in range(W):
                if i == 0:
                    if j == W-1:
                        print("
                    else:
                        print("
                elif i == H-1:
                    if j == W-1:
                        print("
                    else:
                        print("
                elif j == 0:
                    print("
                elif j == W-1:
                    print("
                else:
                    print(".", end="")