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

Solution (Python):
while True:
    a,b = map(int,input().split())
    if a == 0 or b == 0:
        break
    else:
        for i in range(a):
            if i == 0 or i == a-1:
                print('
            else:
                print('
            if i == a-1:
                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
    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 or 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
    
    edge_str = "
    middle_str = "
    for i in range(1, H+1):
        if i == 1 or i == H:
            print(edge_str)
        else:
            print(middle_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:
				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 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 = list(map(int, input().split()))
    if h == 0 and w == 0:
        break
    
    for i in range(h):
        if i == 0 or i + 1 == h:
            print("
        else:
            print(f'
    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 1:
    h,w=map(int,input().split())
    if (h,w)==(0,0):
        break
    print("
    for i in range(h-2):
        print("
    print("

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

Solution (Python):
while True:
    h,w = input().split()
    h,w = int(h),int(w)
    if h==0 and w==0:
        break
    s1 = '
    s2 = '
    print(s1)
    for i in range(h-2):
        print(s2)
    print(s1)
    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):
def f(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 == w == 0:
        break

    f(h, w)
    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
    print("
    for i in range(h-2):
        print("
    print("
    print()

Solution (Python):
while True:
    n = input().split()
    h = int(n[0])
    w = int(n[1])
    if h ==0 and w==0:
        break
    a = "
    b = "
    print(a)
    for x in range(h-2):
        print(b)
    print(a)
    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:
			for n in range(b):
				print('
		else:
			print('
			for g in range(b-2):
				print('.',end='')
			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 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 and W==0:
        break
    elif H>2 and W>2:
        print("
        for i in range(H-2):
            print("
        print("
    else:
        for i in range(H):
            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-h+1,h-1):
            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):
        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):
BIG_NUM = 2000000000
 
while True:
 
    H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if i == 0 or i == H-1 or k == 0 or k == W-1:
                print("
            else:
                print(".",end = "")
        print()
 
    print()

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

Solution (Python):
def render_rect(H,W):
    for i in range(H):
        if i in [0,H-1]:
            print("
        else:
            print("
    print()

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

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 == W == 0:
        break

    print('

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

    print('
    print()

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

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

Solution (Python):
if __name__ == "__main__":
    while True:
        h, w = map(lambda x: int(x), input().split())

        if (w == 0 & 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 = 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 != 0 and i != H - 1:
                if j == 0:
                    print("
                elif j != 0 and j != W - 1:
                    print(".", end = "")
                else:
                    print("
            else:
                print("
        print("")
    print()

Solution (Python):
while True:
	INPUT = [int(i) for i in input().split()]
	a = INPUT[0]
	b = INPUT[1]
	
	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):
def draw_rect_outline(h, w):
    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("")

while True:
    [h, w] = map(int, input().split(" "))
    if h == 0 and w == 0:
        break
    
    draw_rect_outline(h, w)

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

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

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

Solution (Python):
while True:
    n = input().split(" ")
    H = int(n[0])
    W = int(n[1])
    
    if H == 0 and W == 0:
        break
    
    for i in range(W):
        print("
    print()
    for j in range(H-2):
        print("
        for k in range(W-2):
            print(".",end="")
        print("
        print()
    for l 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):
        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):





for _ in range(100):
    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(W):
        print('
    print()
    for i in range(H - 2):
        print('
        for j in range(W - 2):
            print('.', end='')
        print('
    for i in range(W):
        print('
    print('\n')

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

def output(W,H):
    i=1
    while i<=H:
        if i==1:
            print("
        elif i==H:
            print("
        else:
            print("
        i=i+1
    print("")

input_number=input()

array=input_number.split()


W=int(array[0])
H=int(array[1])

while not( W==0 and H==0):

    output(H,W)
    
    input_number=input()
    array=input_number.split()
    W=int(array[0])
    H=int(array[1])

Solution (Python):

while True:
    H,W=(int(x) for x in input().split())
    if H==0 & 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 = [int(x) for x in input().split()]
    if (H,W)==(0,0): break
    for i in range(H):
        if i==0 or i==H-1:
            print("
        else:
            print("
    print("")

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

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

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

Solution (Python):
while True:
    H, W = input().split()
    if H == "0" and W == "0":
        break
    H = int(H)
    W = int(W)
    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:
  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 = list(map(int,input().split()))
    if h==0: break
    rect = "
    if h<3 or w<3:
        rect += rect * (h-1)
    else:
        rect += ("
    print(rect)

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

Solution (Python):
BIG_NUM = 2000000000

while True:

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

    print()

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

Solution (Python):
while True:

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

    print()

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

  if H == 0 and W == 0:
    break
  
  print('
  for i in range(H-2):
      print("
  print('
  print()

Solution (Python):
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(1, H-1):
    print('
    for j in range(1, W-1):
      print('.', end='')
    print('
  print('
  print()

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

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

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

	print()

Solution (Python):
while True:
    L=input().split( )
    H=int(L[0])
    W=int(L[1])
    if H==0 and W==0:
        break
    i=1
    row =''
    while i<=W:
        row=row+"
        i+=1
    print(row)
    inside="
    j=1
    while j<=W-2:
        inside=inside+"."
        j+=1
    inside=inside+"
    k=1
    while k<=H-2:
        print(inside)
        k+=1
    print(row)
    print()

Solution (Python):
while True:
    H, W = list(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):
                if w == (W - 1):
                    print('
                else:
                    print('
            else:
                print('.', end="")
    print()

Solution (Python):


from collections import* 
from fractions import gcd
from functools import* 
from itertools import* 
from operator import mul
from bisect import* 
from heapq import* 
from math import factorial,pi
from copy import deepcopy
import sys

sys.setrecursionlimit(10**6)


def main():
    while 1:
        s=input()
        if "0 0" in s:
            break
        else:
            a,b=map(int,s.split())
            print("
            for i in range(a-2):
                print("
            print("
        print()

if __name__ == '__main__':
    main()

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

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

Solution (Python):
while True:
    num_H, num_W = list(map(int, input().split()))
    if num_H == num_W == 0:
        exit()
    num_W1 =num_W -2
    print("
    for count in range(num_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 & 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):
lines = []
colums = []
 
while True:
 H,W = map(int,input().split())
 if H == 0 and W == 0:
   break
 lines.append(H)
 colums.append(W)
 
for H,W in zip(lines,colums):
 for i in range(H):
   if i == 0 or i == H-1:
     for j in range(W):
       print("
   else:
     for j in range(W):
       if 0 < j and j < W-1:
         print(".",end="")
       else:
         print("
   print("\n",end="")
 print("\n",end="")

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

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

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

Solution (Python):
H_list=[]
W_list=[]
while True:
  H,W = map(int, input().split())
  if H == 0 and W == 0: 
    break
  H_list.append(H)
  W_list.append(W)
  
for (Hlist, Wlist) in zip(H_list,W_list):
  for i in range(Hlist):
    for j in range(Wlist):
        if i==0 or j==0 or i==Hlist-1 or j==Wlist-1: 
            print("
        else:
            print(".", end="")
    print()
  print()

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

  print()
    
  for j in range(a-2):
    print("
    
    for i in range(b-2):
      print(".", end="")
      
    print("
    print()
    
  for i in range(b):
    print("
  
  print()
    
  print()

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

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


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

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

Solution (Python):
while True:
    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:
    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):
lines = []
colums = []
   
while True:
  H,W = map(int,input().split())
  if H == 0 and W == 0:
    break
  lines.append(H)
  colums.append(W)
   
for H,W in zip(lines,colums):
  for i in range(H):
    if i == 0 or i == H-1:
      for j in range(W):
        print("
    else:
      for j in range(W):
        if 0 < j and j < W-1:
          print(".",end="")
        else:
          print("
    print("\n",end="")
  print("\n",end="")

Solution (Python):
lines = []
colums = []
  
while True:
  H,W = map(int,input().split())
  if H == 0 and W == 0:
    break
  lines.append(H)
  colums.append(W)
  
for H,W in zip(lines,colums):
  for i in range(H):
    if i == 0 or i == H-1:
      for j in range(W):
        print("
    else:
      for j in range(W):
        if 0 < j and j < W-1:
          print(".",end="")
        else:
          print("
    print("\n",end="")
  print("\n",end="")