Problem:
Print a Frame Draw a frame which has a height of H cm and a width of W cm. For example, the following figure shows a frame which has a height of 6 cm and a width of 10 cm. ##########
#........#
#........#
#........#
#........#
########## Input The input consists of multiple datasets. Each dataset consists of two integers H and W separated by a single space. The input ends with two 0 (when both H and W are zero). Output For each dataset, print the frame made of '#' and '.'. Print a blank line after each dataset. Constraints  3 ≤ H ≤ 300  3 ≤ W ≤ 300  Sample Input 3 4
5 6
3 3
0 0 Sample Output ####
#..#
####

######
#....#
#....#
#....#
######

###
#.#
###

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

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

Solution (Python):


while True:
    H, W = (int(i) for i in 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())
    i = 0

    if H == 0 and W == 0:
        break
    for i in range(H):
        if i == 0 or i == H-1:
            print('
        else:
            print('
            print('.'*(W-2),end='')
            print('
    print()

Solution (Python):
for i in range(10000):
    H,W=input().split()
    if H=="0" and W=="0":
        break
    s=""
    t=""
    for j in range(int(W)):
        s+="
        if j==0 or j==int(W)-1:
            t+="
        else:
            t+="."
    for k in range(int(H)):
        if k==0 or k==int(H)-1:
            print(s)
        else:
            print(t)
    print("")

Solution (Python):



import sys

while True:
    h, w = map(int, sys.stdin.readline().split())
    if h == 0  and w == 0:
        break

    top_bot = '
    mid = '
    print(top_bot)
    for row in range(h-2):
        print(mid)
    print(top_bot)
    print()

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

Solution (Python):
H, W = [int(i) for i in input().split()]
while (H != 0) and (W != 0):
    e = '
    m = ('\n' + '
    print('{0}{1}\n{0}\n'.format(e, m))
    H, W = [int(i) for i in input().split()]

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):
		break
	print('
	[print('
	print('
	print()

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

Solution (Python):


if __name__ == '__main__':
    while True :
        h, w = map(int, raw_input().split())
        if h == 0 and w == 0:
            break

        ht = "
        md = "
        print ht + md*(h-2) + ht

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

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

Solution (Python):
a=[]
i=0
while 1:
    l=input().split()

    h=int(l[0])
    w=int(l[1])

    if h==0 and w==0:
        break
    else:
        a.append(h-2)
        a.append(w-2)
        i=i+2

m=0
while m<i:
    w=a[m+1]+2
    print(w*"
    while a[m]>0:
        print("
        a[m]=a[m]-1
    print(w*"
    print("")
    m=m+2

Solution (Python):
ans = ''
while True:
    h, w = map(int, input().split(' '))
    if h == 0 and w == 0:
        break
    else:
        ans += '
        i = 0
        while i < h-2:
            ans += '
            i += 1
        ans += '
if ans != '':
    print(ans[:-1])

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

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

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

Solution (Python):
a, b = map(int, input(). split())
while a != 0 and b != 0:
  for i in range(b):
    print("
  print("")
  for i in range (a-2):
      print("
      for j in range (b-2):
          print(".", end="")
      print("
  for i in range(b):
    print("
  print("")
  print("")
  a, b= map(int, input(). split())

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):
a = []
b = []
flag = 0
while True:
    H,W = map(int,raw_input().split())
    if H == 0 and W == 0:
        break
    a.append(H)
    b.append(W)
    flag+=1

for k in range(0,flag):
    head = ""
    naka = ""
    for i in range(b[k]):
        head+="
        if i == 0 or i == b[k]-1:
            naka+="
        else:
            naka+="."
    for j in range(a[k]):
        if j == 0 or j == a[k]-1:
            print head
        else:
            print naka
    print ""

Solution (Python):
import sys

l = []
for i in sys.stdin:
    l.append(i.split())

for i in range(0,len(l)):
    if l[i][0] == '0' or l[i][1] == '0':
        continue
    for j in range(0,int(l[i][0])):
        if j == 0 or j == int(l[i][0])-1:
            print("
        else:
            print("
            print("." * (int(l[i][1])-2),end='')
            print("
    print()

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

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

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

Solution (Python):
H = []
W = []
while(True):
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    else:
        H.append(x)
        W.append(y)
for i in range(len(H)):
    for j in range(H[i]):
        if j == 0:
            print(W[i]*"
            
        elif j+1 == H[i]:
            print(W[i]*"
            
        else:
            print("

Solution (Python):
i=0
while i < 300:
    h, w = map(int, input().split())
    
    if h == 0 and w == 0:
        break
    else:
        for a in range(w):
            print("
        print()
        for b in range(h-2):
            print("
            for c in range(w-2):
                print(".", end="")
            print("
        for d in range(w):
            print("
        print()
        print()

Solution (Python):


while True:
    n = list(map(int, input().split()))
    if n[0] == 0 & n[1] == 0:
        break

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

        print()

    print()

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

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

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

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

   print("

   print("")

Solution (Python):
while True:
    a, b = map(int, input().split())
    if a == 0 and b == 0:
        break
    p = b - 2
    c = ""
    for _ in range(b):
        c += "
    c += "\n"
    for _ in range(a - 2):
        c += "
        for __ in range(p):
            c += "."
        c += "
        c += "\n"
    for _ in range(b):
        c += "
    c += "\n"
    print(c)

Solution (Python):



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

    for i in range(H):
        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):
while True:
    H, W = map(int, input().split())

    if H + W == 0: break

    print('

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

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:
    x = [int(i) for i in input().split()]
    if x[0] == 0 and x[1] == 0:
        break
    for w in range(x[1]):
        print("
    print("")
    for h in range(x[0] - 2):
        print("
        for w in range(x[1] - 2):
            print(".", end="")
        print("
        print("")
    for w in range(x[1]):
        print("
    print("\n")

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

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

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

Solution (Python):
def numinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a
  
def main():
    while True:
        a = numinput()
        if a[0] == 0 and a[1] == 0: break
        H = a[0];  W = a[1]
        for i in range(H):
            bar = ""
            for j in range(W):
                if i > 0 and i < H - 1 and j > 0 and j < W - 1: bar += "."
                else: bar += "
            if i < H - 1: print(bar)
            else: print(bar + '\n')
  
if __name__ == "__main__":
    main()

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

Solution (Python):
while True:
    h, w = [int(i) for i in input().split()]
    if w == h == 0:
        break
    print("
    print(("\n
    print("

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

while True:
    x = input().split()
    w, h = int(x[0]), int(x[1])
    if (w, h) == (0, 0): break
    print_fig(w, h)

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 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('{0}{1}{0}'.format('
    print()

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

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

Solution (Python):
a = []
while True:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    a.append([H, W])
for i in range(len(a)):
    b = a[i]
    if b[0] == 1:
        print('
    elif b[0] == 2:
        print('
        print('
    elif b[1] == 1:
        for j in range(0, b[0]):
            print('
    else:
        print('
        for j in range(1,b[0]-1):
            print('
        print('
    print('')

Solution (Python):
sum = 0
while 1:
    sum += 1
    if(sum != 1):
        print()
        print()
    H, W = map(int, input().split())
    if(H == 0 and W == 0):
        break

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

Solution (Python):
2
3
4
5
6
7
8
9
while 1:
    (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):


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

Solution (Python):
import sys

while 1:
	arr = list(map(int, input().split()))
	H = arr[0]
	W = arr[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:
				sys.stdout.write('
				if j == W - 1: print()
			else:
				sys.stdout.write('.')
	print()

Solution (Python):



import sys

if __name__ == '__main__':
    while 1:
        line = raw_input()
        if line == '0 0':
            break
        a, b = map(int, line.split())
        print '
        for i in range(a-2):
        	print '
        print '
        print

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

Solution (Python):
for i in range (0,100000000):
    txt = input("")
    txt1,txt2 = txt.split(" ")
    a = int(txt1)
    b = int(txt2)
    if(a==0&b==0):
        break
    for i in range(0,a):
        for j in range(0,b):
            if((i==0)|(j==0)|(i==(a-1))|(j==(b-1))):
                print("
            else:
                print(".", end="")
        print("")
    print("")

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

Solution (Python):
while 1:
    k=input().split()
    H=int(k[0])
    W=int(k[1])
    if H==0 and W==0:
        break
    for i in range(H):
        msg=""
        if i==0 or i==H-1:
            for j in range(W):
                msg +="
            print(msg)
        else:
            msg="
            for j in range(W-2):
                msg +="."
            msg+="
            print(msg)
    print("")

Solution (Python):


def draw(h, w):
    for i in range(h):
        for j in range(w):
            if 0 < i < h - 1 and 0 < j < w - 1:
                print('.', end = "")
            else:
                print('
        print()
    return ""

inputEnd = 0
while inputEnd == 0:
    n = [int(i) for i in input().rstrip().split()]
    h = n[0]
    w = n[1]
    if h == 0 and w == 0:
        inputEnd += 1
    else:
        print(draw(h, w))

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

for i in range(len(a)):
    print("
    for j in range(1, a[i][0]-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
    print("
    for i in range(1, H-1):
        print("
    print("
    print()

Solution (Python):
def draw(h, w):
    for x in range(0, h):
        if x == 0 or x == h-1:
            print("
        else:
            print("
    print()

while True:
    h, w = map(int, input().split())

    if h == w == 0:
        break;

    draw(h, w)

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

        if (H, W) == (0, 0):
            break
        else:
            for i in range(H):
                if i == 0 or i == H - 1:
                    print("
                else:
                    print("
        print()

if __name__ == '__main__':
    main()

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:
  h, w = map(int, raw_input().split())
  if h + w == 0: break

  print '
  for y in xrange(h - 2):
    print '

  print '
  print

Solution (Python):
import sys
x = []
for line in sys.stdin:
    h,w = line.split()
    h,w = int(h), int(w)
    if h == 0 and w== 0: break
    x.append([h,w])

for i in range(len(x)):
    h, w = x[i]
    s1 = '
    if w<2:
        s2 = s1
    else:
        s2='
    for j in range(h):
        if j in [0, h-1]: print s1
        else: print s2
    print

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

    s1 = '
    if w < 2:
        s2 = s1
    else:
        s2='
    for j in range(h):
        if j in [0, h-1]: print s1
        else: print s2
    print

Solution (Python):
while 1:
    h,w=map(int,raw_input().split())
    if h==w==0: break
    ans=[['
    for i in range(1,h-1):
        for j in range(1,w-1):
            ans[i][j]='.'
    for i in range(h):
        print ''.join(ans[i])
    print ''

Solution (Python):
r=0
while r==0:
        L=""
        l="
        i=map(int,raw_input().split())
        if i[0]==i[1]==0:
                break
        a=i[1]
        b=i[1]-2
        c=i[0]-2
        while 0 < a:
                L=L+"
                a=a-1
        while 0 < b:
                l=l+"."
                b=b-1
        l=l+"
        print L
        while 0 < c:
                print l
                c=c-1
        print L
        print

Solution (Python):



def main():
    while True:
        h, w = [int(x) for x in raw_input().split(" ")]
        if h == 0 and w == 0:
            break

        for x in range(1, h+1):
            if x == 1 or x == h:
                print "
            else:
                if w >= 3:
                    print "
                else:
                    print "
        print

if __name__ == '__main__':
    main()

Solution (Python):
from __future__ import division, print_function
from sys import stdin
for line in stdin:
    h, w = (int(s) for s in line.split())
    if h == 0 and w == 0:
        break
    top_bottom = '
    mid_row = '
    print(top_bottom)
    for _ in range(h-2):
        print(mid_row)
    print(top_bottom, end='\n\n')

Solution (Python):
import sys
for line in sys.stdin:
    h, w = map(int, line.rstrip('\n').split(' '))
    if h == 0 and w == 0: break
    for row in range(h):
        if row in (0, h-1):
            print '
        else:
            print '
    print ''

Solution (Python):
while True:
    (m,n)=map(int, raw_input().split())
    if n==0 and m==0: break
    for i in xrange(m):
        if i==0 or i==m-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 xrange(h):
		line = ""
		for j in xrange(w):
			if (i*j == 0) or ((i-h+1)*(j-w+1) == 0):
				line += "
			else:
				line += "."
		print line
	print

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

    if h == 0 and w == 0:
        break
    
    hcnt = 1
    for i in range(0, h):
        wid = ""
        if hcnt == 1 or hcnt == h:
            for j in range(0, w):
                wid += "
            print wid
        else:
            wid += "
            for j in range(1, w-1):
                wid += "."
            wid += "
            print wid
        hcnt += 1
    print ""

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

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

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

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

Solution (Python):
from sys import stdin

while True:
    (h, w) = [int(i) for i in stdin.readline().split(' ')]
    if h == 0 and w == 0:
        break

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

        print()

    print()

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

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

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

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

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

Solution (Python):
while True:
    h,w = map(int,input().split())
    if (h == 0) & (w == 0):
        break
    else:
        for i in range(w):
            print("
        print( sep = '\n')
        for j in range( h-2 ):
            print("
            for k in range(w-2):
                print(".",end="")
            print("
        for l in range(w):
            print("
        print()
        print(sep = '\n')

Solution (Python):

import sys
Input = []
while True:
    try:
        a,b = list(map(int, input().split()))
        Input += a,b
    except EOFError:
        break
    if a!=0:
        for j in range(a):
            for i in range(b):
                if j==0 or i==0 or j==a-1 or i==b-1:
                    print("
                else:
                    print('.',end='')
            print()
        print()

Solution (Python):
import sys
Input = []
while True:
    try:
        a,b = list(map(int, input().split()))
        Input += a,b
    except EOFError:
        break
    if a!=0:
        for j in range(a):
            for i in range(b):
                if j==0 or i==0 or j==a-1 or i==b-1:
                    print("
                else:
                    print('.',end='')
            print()
        print()