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) = [int(x) for x in input().split()]
    if H == W == 0:
     break

    for h in range(H):
     for w in range(W):
      if h == 0 or h == H - 1:
       print("
       if w == W - 1:
        print()
        break
      elif w == 0:
       print("
      elif not w == 0 and not w == W - 1:
       print(".", end="")

      if w == W - 1:
       print("
       break

    print()

Solution (Python):
while True:
    (H,W) = [int(x) for x in 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("
       if w == W - 1:
        print()
        break
      elif not w == 0 and not w == W - 1:
       print(".", end="")

    print()

Solution (Python):
while True:
    (H,W) = [int(x) for x in 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("
       if w == W - 1:
        print()
        break
      else:
       print(".", end="")

    print()

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

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

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

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

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

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

Solution (Python):
import sys

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

Solution (Python):
data_h = []
data_w = []
while True:
  h, w = (int(i) for i in input().split())
  if h == w == 0:
    break
  else:
    data_h.append(h)
    data_w.append(w)

for i in range(len(data_h)):
  h = data_h[i]
  w = data_w[i]
  for j in range(1,h+1):
    for k in range(1,w+1):
      if j == 1 or j == h or k == 1 or k == w:
        print('
      else:
        print('.',end='')
    print('')
  print('')

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

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

Solution (Python):
import sys
while True:
    (H, W) = [int(i) for i in sys.stdin.readline().split()]
    if H == W == 0:
        break
    print("
    print(("
    print("

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

    for hc in range(H):
        for wc in range(W):
            if hc == 0 or wc == 0 or hc == H - 1 or wc == 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(("
    print("

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

Solution (Python):
def solve(h, w):
    print('
    print(('\n
    print('
    print()

if __name__ == '__main__':
    while True:
        h, w = [int(i) for i in input().split()]
        if h == w == 0: break
        solve(h, w)

Solution (Python):


while True:
    length,width = map(int,input().split())
    if (length,width) == (0,0):
        break

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

Solution (Python):


while True:
    length,width = map(int,input().split())
    if length == width == 0:
        break

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

Solution (Python):


while True:
    length,width = map(int,input().split())
    if length == width == 0:
        break
    print('
    print(('
    print('
    print()

Solution (Python):
while 1:
	H,W=map(int,raw_input().split())
	if H==W==0:break
	print(W*'
	while H>2:
		print('
		H=H-1
	print(W*'

Solution (Python):
while 1:
 w,h=map(int,raw_input().split())
 if(w==0):break
 a,b="

Solution (Python):
while 1:
 w,h=map(int,raw_input().split());a,b="
 if w==0:break
 print a*h+b+(a+"."*(h-2)+a+b)*(w-2)+a*h+b

Solution (Python):
import sys
while True:
	y,x=map(int, input().split())
	if x==y==0: break
	print('
	for i in range(2,y)	:
		sys.stdout.write('
		sys.stdout.write('.'*(x-2))
		print('
	print('

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

Solution (Python):
import sys

while True:
	h, w = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 ==h and 0 == w:
		break
	for i in range( h ):
		if 0 == i or h-1 == i:
			print( "
		else:
			print( "
	print( "" )

Solution (Python):
import sys

while True:
	h, w = [ int( val ) for val in sys.stdin.readline().split( " " ) ]
	if 0 ==h and 0 == w:
		break
	for i in range( h ):
		if 0 == i or h-1 == i:
			print( "
		else:
			print( "
	print( "" )

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

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

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

Solution (Python):


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

Solution (Python):
while True:
    h, w = map(int, input().split())
    if h == w == 0:
        break
    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):
if __name__ == "__main__":
    ct = 0
    while True:
        nums = map( int, raw_input().split())
        H = nums[0]
        W = nums[1]
        if H == 0:
            if W == 0:
                break

        sf = ""
        sb = ""
        j = 0
        while j < W:
            if j == 0:
                sb += "
            elif j == W-1:
                sb += "
            else:
                sb += "."
            sf += "
            j += 1

        i = 0
        while i < H:
            if i == 0:
                print sf
            elif i == H-1:
                print sf
            else:
                print sb
            i += 1
        print

Solution (Python):


while True:
    height, width = map(int, raw_input().split())
    if height + width == 0:
        break
    else:
        outer = '
        inner = '
        print outer + inner * (height - 2) + outer

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

Solution (Python):
while 1:
    H, W = list(map(int, input().split()))
    if H == 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) = [int(i) for i in input().split()]
    if H == W == 0:
        break
    print('
    for a in range(H-2):
        print('
    print('
    print('')

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

    [print('
            for i in range(H)]
    print()

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

Solution (Python):
while True:
  ( H, W) = [ int(i) for i in input().split()]
  if H == 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:
        pass
        print( '
      else:
        print( '.', end='')
    print()
  print()

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

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

Solution (Python):
while True:
  ( H, W) = [ int(i) for i in input().split()]
  if H == 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:
        pass
        print( '
      else:
        print( '.', end='')
    print()
  print()

Solution (Python):
while True:
    (H, W) = [int(i) for i in input().split()]

    if H == W == 0:
        break

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

Solution (Python):
h = -1
w = -1

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

  i = 1
  j = 0
  inner_line = "
  outer_line = ""

  while j < w:
    outer_line += "
    if (j != 0 and j != w - 1):
      inner_line += "."
    j += 1
  inner_line += "

  print outer_line  
  while i < h - 1:
    print inner_line
    i += 1
  print outer_line

  print ""

Solution (Python):
import sys
while True:
    (H, W) = [int(i) for i in sys.stdin.readline().split()]
    if H == W == 0:
        break
    print("
    print(("
    print("

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
from itertools import starmap
(lambda *_: None)(
    *map(print,
         starmap(lambda h, w: ''.join(['
                                      ['
                                      ['
                 map(lambda ss: map(int, ss),
                     map(str.split, iter(input, '0 0'))))))

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

while H != 0 or W != 0 :

    print('
    for i in range(H-2) :
        print('
        print('.' * (W - 2), end = '')
        print('
    print('
    print()
    H, W = list(map(int, input().split()))

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

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):
a = []
while True:
    b = map(int, raw_input().split())
    if b == [0, 0]:
        break
    a.append(b)
for list in a:
    h, w = list
    k = 0
    l = 0
    x = []
    y = []
    while k < w:
        x.append('
        k = k + 1
    k = 0
    while k < w:
        if k == 0 or k == w - 1:
            y.append('
        else:
            y.append('.')
        k = k + 1
    while l < h:
        if l == 0 or l == h - 1:
            print ''.join(x)
        else:
            print ''.join(y)
        l = l + 1
    print

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

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

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

Solution (Python):
import sys

while True :
	h,w = map(int,raw_input().split())
	if h==0 and w==0:
		break
	else :
		i,j=[0,0]
		for num in range(h):
			j = 0
			if i==0 or i==h-1 :
				print '
			else :
				for nnum in range(w):
					if j==0 : 
						sys.stdout.write('
						j += 1
					elif j==w-1 :
						sys.stdout.write('
						j += 1
					else :
						sys.stdout.write('.')
						j += 1
			i += 1
	print''

Solution (Python):
while True:
    h,w = map(int,raw_input().split())
    if h==0 and w==0:
        break
    sside="" 
    inside=""
    for x in xrange(1,w+1):
        sside += "
        if x==1 or x==w:
            inside += "
        else:
            inside += "."
    for x in xrange(1,h+1):
        if x==1 or x==h:
            print sside
        else:
            print inside
    print

Solution (Python):
while 1:
  H, W=map(int, raw_input().split())
  if H==0 and W==0:
    break
  for i in range(H):
    L=list("
    if i==0 or i==(H-1):
      s="".join(L)
      print s
    else:
      for j in range(1, W-1):
        L[j]="."
        s="".join(L)
      print s
  print ""

Solution (Python):


while True:
    h,w = map(int,raw_input().split())
    if h+w==0:
    	break
    else:
    	print w*'
    	for hight in range(h-2):
            print '
        print w*'
        print

Solution (Python):
l = []
while True:
  h,w = map(int,input().split())
  if (h,w) == (0,0):
    break
  else:
    l.append([h,w])
for i in l:
  print('
  for j in range(i[0]-2):
    print('
  print('
  print()

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

Solution (Python):
nums = []
while True:
    in_line = raw_input().split()
    h = int(in_line[0])
    w = int(in_line[1])
    if h == 0 and w == 0:
        break
    else:
        nums.append([h,w])
for num in nums:
    for i in range(0,num[0]):
        if i == 0 or i == num[0]-1:
            print "
        else:
            print "
    print ""

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

Solution (Python):
import sys

for v in iter(sys.stdin.readline,''):
    h,w = map(int,v.split())

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

    print('

    for i in range(h-2):
        print('

    print('
    print('')

Solution (Python):



import sys

io = sys.stdin

while True:
    H, W = io.readline().split()
    h, w = int(H), int(W)
    if w==0 and h==0: break

    print "
    for x in xrange(h-2):
        print "

    print "
    print
pass

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 or y==h-1 or x==0 or x==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
	else:
		for n in range(0, H):
			s = ""
			for m in range(0, W):
				if (1 <= n and n <= (H-2)) and(1 <= m and m <= (W-2)):
					s += "."
				else :
					s += "
			print(s)
		print("")

Solution (Python):
while True:
	H,W = list(map(int, input().split()))
	if (H == 0 and W == 0):
		break
	else:
		for n in range(0, H):
			s = ""
			for m in range(0, W):
				if (1 <= n and n <= (H-2)) and (1 <= m and m <= (W-2)):
					s += "."
				else:
					s += "
			print(s)
		print("")

Solution (Python):


import sys

rectangle = []
h,w = 1,1

while not(h == 0 and w == 0):
    h,w = map(int, input().split())
    if not(h == 0 and w == 0):
        rectangle.append([h-2,w-2])

for rec in rectangle:

    display = []

    for col in range(rec[1] + 2):
        display.append('
    
    display.append('\n')
    
    for row in range(rec[0]):
        
        display.append('
        for col in range(rec[1]):
            display.append('.')
        display.append('
        display.append('\n')
    
    for col in range(rec[1] + 2):
        display.append('
    display.append('\n')
    print(''.join(display))

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

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

Solution (Python):
H = []
W = []
i = 0
while True:
  h, w = map(int, input().split())
  H.append(h)
  W.append(w)
  if H[i] == 0 and W[i] == 0:
    break
  i += 1

i = 0
while True:
  if H[i] == 0 and W[i] == 0:
    break
  for k in range(W[i]):
    print("
  print()
  for j in range(H[i] - 2):
    print("
    for k in range(W[i] - 2):
      print(".", end = "")
    print("
  for k in range(W[i]):
    print("
  print()
  print()
  i += 1

Solution (Python):
while 1:
   H, W = map(int, raw_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, raw_input().split())
 if (H+W) == 0:
  break
 print "
 for h in range(1, (H-1)):
  print  "
 print "
 print ""

Solution (Python):
while 1:
    h, w = map(int, raw_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, raw_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):
import sys
while True:
    a,b = map(int, raw_input().split())
    if a ==0 and b == 0:
        break
    for i in range(a):
        for j in range(b):
            if i == 0 or i == a-1 or j == 0 or j == b-1:
                sys.stdout.write("
            else:
                sys.stdout.write(".")
        print 
    print

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

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

Solution (Python):
import sys
while 1 > 0:
    height, width = map(int, raw_input().split())
    if height == 0 and width == 0:
        break
    for i in range(width):
        sys.stdout.write("
    print ""
    for i in range(height - 2):
        sys.stdout.write("
        for j in range(width - 2):
            sys.stdout.write(".")
        sys.stdout.write("
        print ""
    for i in range(width):
        sys.stdout.write("
    print ""
    print

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

   print ""

Solution (Python):
x = 0
while x == 0:

 m = map(int,raw_input().split())

 if m[0] == 0 and m[1] == 0:
     break

 print "
 for i in xrange(m[0]-2):
    print "
 print "
 print ""

Solution (Python):

import sys
write = sys.stdout.write

while True:
    entry = map(int, raw_input().split())
    H = entry[0]
    W = entry[1]
    if H == 0 and W == 0:
        break
    
    for j in range(W):
    	write("
    print ""
    for j in range(H - 2):
        write("
    	for k in range(W - 2):
    		write(".")
    	write("
    	print ""
    for j in range(W):
    	write("
    print ""
    print ""

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

Solution (Python):

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

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

   print b *"
   for i in range(1,a-1):   
      print "
   
   print b*"
   print ""

Solution (Python):
while(True):
    H, W = map(int, raw_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):
import sys
while 1:
  H, W = map(int, raw_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:
        sys.stdout.write('
      else:
        sys.stdout.write('.')
    sys.stdout.write('\n')
  print ''

Solution (Python):
while(True):
    (H,W)=[int(s) for s in input().split()]
    if (H,W) == (0,0):
        break
    print("
    for j in range(H-2):
        print("
        print("."*(W-2),end="")
        print("
    print("
    print("")

Solution (Python):
a = map(int, raw_input().split())
while a != [0,0]:
	print '
	for i in xrange(a[0]-2):
		print '
	print '
	a = map(int, raw_input().split())
	print ""

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

Solution (Python):
x = 0
while x == 0:
 
 m = map(int,raw_input().split())
 
 if m[0] == 0 and m[1] == 0:
     break
 
 print "
 for i in xrange(m[0]-2):
    print "
 print "
 print

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

Solution (Python):
while True:
  H,W=map(int,raw_input().split())
  if H==W==0:
    break
  elif H!=0 or W!=0:
    print (('

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

Solution (Python):
y,x = [int(x) for x in input().split()]
while(x > 0 or y > 0):
    print('
    st  = '
    st += '.' * (x-2)
    st += '
    for i in range(1, y-1):
        print(st)
        
    print('
    print()
    y,x = [int(x) for x in input().split()]

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

Solution (Python):
while 1:
    H, W = map(int ,raw_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 = list(map(int, input().split()))
	if (H == 0 and W == 0):
		break
	else:
		for n in range(H):
			s = ""
			for m in range(W):
				if (0 < n and n < H-1) and (0 < m and m < W-1):
					s += "."
				else:
					s += "
			print(s)
		print("")

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

Solution (Python):
while True:
    h,w = map(int,raw_input().split())
    if h==0 and w==0:
        break
    sside="" 
    inside=""
    for x in xrange(1,w+1):
        sside += "
        if x==1 or x==w:
            inside += "
        else:
            inside += "."
    for x in xrange(1,h+1):
        if x==1 or x==h:
            print sside
        else:
            print inside
    print

Solution (Python):
while True:
    h,w = tuple([int(x) for x in raw_input().split(" ")])
    if h==0 and w==0: break
 
    for ih in range(h):
        if ih==0 or ih==h-1 or w <= 2: print "
        else: print "
 
    print ""

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

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

Solution (Python):


while True:
	l = raw_input().split()

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

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

	else :
		a = 1
		print "
		x = "

		while a < H - 1:
			print x
			a += 1

		print "

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

Solution (Python):


while True:
    h, w = map(int, raw_input().split())
    if h == w == 0:
        break
    print(w * "
    for i in xrange(h - 2):
        print("
    print(w * "
    print("")

Solution (Python):
h = []
w = []
while True:
    a,b = map(int, raw_input().split())
    h.append(a)
    w.append(b) 
    if a == 0 and b == 0:
        break

for h,w in zip(h,w):    
    if h == 0 and w == 0:
        break;
    else:
	c = "
	d = "
        for x in xrange(w-2):
            c = c + "
	    d = d + "."
	c += "
	d += "
        for x in xrange(h):
	    if x == 0 or x == h-1: 
		print c
	    else:
		print d
    print

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

Solution (Python):
while 1:
	H, W = map(int, raw_input().split())

	if H == W == 0:
		break
	print ("

Solution (Python):


while True:
    line = map(str, raw_input().split())
    H = int(line[0])
    W = int(line[1])
    if H+W:
        for i in range(H):
            if i == 0 or i == (H-1):
                print "
            else:
                print "
        print ""
    else:
        break