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):
        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 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 _ in range(h-2):
        print("
    print("
    print()

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

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

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):
ls = []
while 1:
    ls1 = list(map(int,input().split()))
    if ls1[0] == 0 and ls1[1] == 0:
        break
    else:
        ls.append(list(ls1))
        
        ls1.clear()

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

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

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("
    str = "
    for i in range(H - 2):
        print(str)
    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):
import sys


def resolve():
    for line in sys.stdin:
        h, w = map(int, line.split())

        if h == w == 0:
            return

        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()



resolve()

Solution (Python):
while True:
    dataset = input().split(" ")

    H = int(dataset[0])
    W = int(dataset[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()

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):
h,w = map(int,input().split())

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

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
	print("
	for i in range(H - 2):
		print("
	print("
	print()

Solution (Python):
data=[]
while(True):
  a,b=map(int,input().split(' '))
  if a==0 and b==0:
    break
  data.append((a,b))

  

for a,b in data:
  line='
  line2='
  for i in range(a):
    if i==0:
      print(line)
    elif i==a-1:
      print(line)
    else:
      print(line2)
  print('')

Solution (Python):
while True:
    H,W = [int(i) for i in input().strip().split()]
    if H < 3 or W < 3:
        break
    print("
    for h in range(1,H-1):
        print("
    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('
        else:
            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 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):
a = []
while True:
  H, W = list(map(int, input().split(' ')))
  if H == 0 and W == 0:
    break
  a.append([H, W])
for l in a:
  for h in range(l[0]):
    for w in range(l[1]):
      if (w == 0 or w == l[1] - 1) or (h == 0 or h == l[0] - 1):
        print('
      else:
        print('.', end='')
    print('', sep="\n")
  print('', sep="\n")

Solution (Python):
while True:
    H, W = map(int, 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
    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==0 and b==0:
        break
    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==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):
        if i == 0 or i == h-1:
            print('
        else:
            print('
    print('')

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

Solution (Python):
while True:
    height, width = map(int, input().split())
    if height == 0 and width == 0:
        break
    
    sx,sy,ex,ey = 0, 0, width-1, height-1
    for col in range(height):
        for row in range(width):
            if col == sy or col == ey or row == sx or row == ex:
                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==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
    print("
    for i in range (H-2):
        print("{}{}{}".format("
    print("
    print()

Solution (Python):
while True:
    height, width = [int(x) for x in input().split(" ")]
    if height == width == 0:
        break
    print("
    column = "
    for i in range(height - 2):
        print(column)
    print("

Solution (Python):
def LI():return map(int,input().split())
def I(): return input().split()

while(True):
    a,b=LI()
    if a==b==0:
        break
    else:
        lst = []
        for i in range(a):
            lst_a=[]
            if i==0 or i==a-1:
                for j in range(b):
                    lst_a.append("
                lst.append(lst_a)
            else:
                for j in range(b):
                    if j==0 or j==b-1:
                        lst_a.append("
                    else:
                        lst_a.append ( "." )
                lst.append(lst_a)

    for i in range(a):
        for j in range(b):
            print(lst[i][j],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
    print("
    for i in range(H - 2):
        print("
    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 i==0 or j==0 or i==b-1 or j==a-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
    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) :
        if h == 0 or h == H-1 :
            print("
        else :
            print("
            print()
    print()

Solution (Python):
inp = []
i = 0
j = 0
k = 0
l = 0

while True:
    inp.append(list(map(int, input().split())))
    if inp[i][0] == 0 and inp[i][1] == 0:
        del inp[i]
        break
    i += 1

for j in range(len(inp)):
    for k in range(inp[j][0]):
        for l in range(inp[j][1]):
            if l == 0 or l+1 == inp[j][1]:
                print(end="
            else:
                if k == 0 or k+1 == inp[j][0]:
                    print(end="
                else:
                    print(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):
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:
                print('
            elif i==H-1:
                print('
            elif j==0:
                print('
            elif 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
    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):
list = []
count = 0
flag = True

while flag:
    h,w=input().split()
    list.append((int(h),int(w)))
    if list[count][0] == 0:
        flag = False
    count += 1


for i in range(len(list)):
    for j in range(list[i][0]):
        print("
        for k in range(1,list[i][1]-1):
            if j== 0 or j==list[i][0]-1:
                print("
            else:
                print(".",end="")
        print("
    if list[i][0] == 0:
        break
    print("")

"""

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

    print("")
"""

Solution (Python):
EOL = '0 0'
stdin = [line for line in iter(input, EOL)]
lines = (map(int, line.split()) for line in stdin)

for H, W in lines:
    for i in range(H):
        edge = '
        mid_point = '
        if i in [0, H - 1]:
            print(edge)
        else:
            print(mid_point)
    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):


def main():
    while True:
        height,width=map(int,input().split())
        if height==0 and width ==0:
            break
        for i in range(height):
            sharp=""
            for j in range(width):
                if i==0 or i==height-1 or j==0 or j==width-1:
                    sharp+="
                else:
                    sharp+="."
            print(sharp)
        print("")

if __name__=="__main__":
    main()

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 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
    tmp = "
    tmp2 = "
    print(tmp)
    for i in range(H-2):
        print(tmp2)
    print(tmp)
    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

    s1 = "
    s2 = "

    for i in range(h):
        if i == 0 or i == h - 1:
            print(s1)
        else:
            print(s2)
    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("
            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 = map(int, input().split())
    if a == 0 and b == 0: break
    for i in range(0, a + 1):
        pt = int(b - 2)
        if i == 0:
            print("
        if 0 < i < a - 1:
            print("
        if i == a:
            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):
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())
  H1 = H-1
  W1 = W-1
  if H == 0 and W == 0:
    break
  for i in range(H):
    for s in range(W):
      if i ==0 or i ==H1:
        print('
      else:
        
        if s == 0 or s==W1:
          print('
        else:
          print('.',end='')
    print()
  print()

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

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

Solution (Python):
list_H=[]
list_W=[]

while True:
    H,W=map(int,input().split())
    if H==0 and W==0:
        break
    else:
        list_H.append(H)
        list_W.append(W)

for i in range(len(list_H)):
    h=list_H[i]
    w=list_W[i]
    x=max(0,h-2)
    y=max(0,w-2)
    if h==0 or w==0:
        pass
    elif h==1:
        print("
        print()
    elif w==1:
        for _ in range(h):
            print("
        print()
    else:
        print("
        for _ in range(x):
            print("
        print("
        print()

Solution (Python):

while True:
  h,w = (input().split())
  h = int(h)
  w = int(w)
  if h == 0 and w == 0:
    break
  for a in range(w):
    print("
  print("")
  for b in range(h-2):
    print("
  for a in range(w):
    print("
  print("\n")

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
    elif H==0 or W==0:
        print()
    elif 0<H<=2:
        for i in range(H):
            print("
        print()
    else:
        print("
        for i in range(1,H-1):
            print(f'{"
        print("
        print()

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

Solution (Python):
while True:
    h, w = list(map(int, input().split()))
    if h == 0 and w == 0:
        break
    print('
    for i in range(1, h - 1):
        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):
    c =""
    for j in range(w):
      if (i == 0) or (i == h-1): 
        c += "
      elif (j == 0) or (j == w-1):
        c += "
      else :
        c += "."
    print(c)
  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):
def lid(l: int):
    "print 
    print("


def wall(l: int):
    "print 
    print("


def buildframe(size: tuple):
    for i in range(size[0]):
        if i == 0 or i == size[0] - 1:
            lid(size[1])
        else:
            wall(size[1])
    print()  


while 1:
    d = tuple(map(int, input().split()))
    if d[0] == d[1] == 0:
        break
    buildframe(d)

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:
                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:
    tate,yoko = (int(x) for x in input().split())
    if tate == 0 and yoko == 0:
        exit()

    for i in range(tate):
        for j in range(yoko):
            if j == 0 or j == yoko - 1 or i == 0 or i == tate - 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 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 = list(map(int, input().split()))
  if h == w and h == 0:
    break
  print("
  for t 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
    for i in range(1,H+1):
        for j in range(1,W+1):
            if j==1 or i==1 or j==W or i==H:
                print("
            else:
                print(".",end="")
        print()
    print()

Solution (Python):
while True:
    h,w = map(int,input().split())
    if h == 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:
        break
    for h_ in range(h):
        if h_ == 0 or h_ == h - 1:
            for w_ in range(w):
                print('
            print()
        else:
            for w_ in range(w):
                if 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 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):
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    while True:
        h, w = ZZ()
        if h == 0 and w == 0: break
        print('
        for _ in range(h-2): print('
        print('
        print('')

    return

if __name__ == '__main__':
    main()

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:
                print('
            elif i == H - 1:
                print('
            else:
                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
    else:
        for i in range(1,H+1):
            
            if i==1 or i==H:
                for l in range(1,W+1):
                    print("
                print()
            else:    
                for l in range(1,W+1):
                    if l==1 or l==W:
                        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:

    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 and i != a-1 and j != 0 and j != b-1:
                print(".", end="")
            else:
                print("

        print()
    print()

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

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

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

Solution (Python):
H,W=map(int,input().split())
while H!=0 or W!=0:
    
    for i in range(W):
        print("
    print() 
    
    for c in range(H-2):
        print("
        for b in range(W-2):
            print(".",end='')
        print("
    
    for i in range(W):
        print("
    print()  
    print()    
    H,W=map(int,input().split())
else:
    pass

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

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

Solution (Python):


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

for h, w in l:
    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):
def naka(a,b,A,B):
    if a == 0 or a == A-1 or b == 0 or b == B-1:
        return '
    return '.'

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):
            print(naka(h,w,H,W), end='')
        print()
    print()

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