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==w==0:break
	for hh in range(h):
		ol=''
		for ww in range(w):
			if hh == h - 1 and ww == w - 1:
				ol+='
			elif hh == 0 or ww == 0 or hh == h - 1 or ww == w - 1:
				ol+='
			else:
				ol+='.'
		print(ol)

Solution (Python):
while True:
	h,w=map(int,input().split())
	if h==w==0:break
	for hh in range(h):
		ol=''
		for ww in range(w):
			if hh == h - 1 and ww == w - 1:
				ol+='
			elif hh == 0 or ww == 0 or hh == h - 1 or ww == w - 1:
				ol+='
			else:
				ol+='.'
		print(ol)

Solution (Python):
while True:
	h,w=map(int,input().split())
	if h==w==0:break
	for hh in range(h):
		ol=''
		for ww in range(w):
			if hh == 0 or ww == 0 or hh == h - 1 or ww == w - 1:
				ol+='
			else:
				ol+='.'
		print(ol)
	print()

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

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

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

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

Solution (Python):
def sh(num):
    for n in num:
        out(n)
def out(n):
    number = []
        
        
    for i in range(n[1]):
        number.append("
    for i in range(1,n[0]+1):
        if i in range(2,n[0]):
            print('
        else:
            print(''.join(number))
    print('')

num = []
while True:
    n = list(map(int, input().split()))
    if n[0] == 0 and n[1] == 0:
        break
    else:
        num.append(n)
sh(num)

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

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

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

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

Solution (Python):


H,W=(int(i) for i in input().split())
while H!=0 or W!=0:
    S=""
    for i in range(W):
        S+="
    print(S)
    for i in range(H-2):
        S="
        for i in range(W-2):
            S+="."
        S+="
        print(S)
    S=""
    for i in range(W):
        S+="
    print(S,end="")
    H,W=(int(i) for i in input().split())
  
    print("\n")

Solution (Python):
while(True):
    h,w = [int(i) for i in input().split()]
    if(h == 0 and w == 0):
        break
    else:
        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):


import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


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

Solution (Python):
while True:

    W,H = tuple(map(int,input().split()))
    if W==0 & H==0:
        break
    print("
    for i in range(1,W-1):
        print("
    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, 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 print_rect(h, w):
    edgeline = "
    midline = "
    print(edgeline)
    for i in range(1, h-1):
        print(midline)
    print(edgeline)
    print("")

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

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

while w != 0 and h != 0:
	print("
	for j in range(h-2):
		print("
		print("."*(w-2), end="")
		print("
	print("
	print()
	h,w = map(int,input().split())

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

Solution (Python):
while True:
    x, y = (int(i) for i in input().split())
    if x ==0 and y == 0:
        break
    else:
        s = "
        line =  s * y
        print(line)
        for i in range(x-2):
            print("
        print(line)
        print()

Solution (Python):
while True:
    h, w = [int(i) for i in input().split()]
    if (h == 0) & (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('
        print('')

    for i in range(w):
        print('
    print('')
    print('')

Solution (Python):
I = input().split()
H = int(I[0])
W = int(I[1])

while H != 0 or W != 0:
    for i in range(H):
        for j in range(W):
            if i == 0 or j == 0 or i % (H - 1) == 0 or j % (W - 1) == 0:
                print('
            else:
                print('.', end = '')
        print()
    print()
    I = input().split()
    H = int(I[0])
    W = int(I[1])

Solution (Python):
while True:
        H, W = map(int, input().split())
        if H == 0 and W == 0:
                break
        countH, countW = 0, 0
        while True:
                if countH == H:
                        break
                if countH == 0 or countH == H - 1:

                        while True:
                                if countW == W:
                                        print('')
                                        break
                                print('
                                countW += 1
                else:
                        print('
                        while True:
                                if countW == W - 2:
                                        break
                                print('.',end='')
                                countW += 1
                        print('
                countW = 0
                countH += 1
        print('')

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

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

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

Solution (Python):
def f(h, w):
    s, t = "
    print(s)
    for _ in range(h-2):
        print(t)
    print(s)
    print()

while True:
    s = input()

    if s == "0 0":
        break
    else:
        h, w = list(map(int, s.split()))
        f(h, w)

Solution (Python):
while True:
        H, W = map(int, input().split())
        if H == 0 and W == 0:
                break
        countH, countW = 0, 0
        while True:
                if countH == H:
                        break
                if countH == 0 or countH == H - 1:
 
                        while True:
                                if countW == W:
                                        print('')
                                        break
                                print('
                                countW += 1
                else:
                        print('
                        while True:
                                if countW == W - 2:
                                        break
                                print('.',end='')
                                countW += 1
                        print('
                countW = 0
                countH += 1
        print('')

Solution (Python):
h_numbers=[]
w_numbers=[]
while True:
    numbers=[]
    numbers=input().split()
    numbers[0]=int(numbers[0])
    numbers[1]=int(numbers[1])
    if numbers[0]==0 and numbers[1]==0:
        break
    h_numbers.append(numbers[0])
    w_numbers.append(numbers[1])

for i in range(0,len(h_numbers)):
    for j in range(0,h_numbers[i]):
        if j==0 or j==(h_numbers[i]-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:
    data = input().split()
    h, w = int(data[0]), int(data[1])
    if h == 0 and w == 0:
        break
    elif h == 0 or w == 0:
        print()
    else:
        for i in range(h):
            if i == 0 or i == h-1:
                print("
            else:
                print("
        print()

Solution (Python):
import sys
for line in sys.stdin:
    H, W = map(int, line.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):
H, W =map(int, input().split())
while not (H == 0 and W == 0):
 for h in range(H):
  if h == 0 or h == H-1:
   print("
  else:
   print("
 print()
 H, W =map(int, input().split())

Solution (Python):
def out_calc(num):
    for i in range(0, num):
        print("
    print("")


def in_calc(num, num2):
    for i in range(0, num-2):
        print("
        for j in range(0, num2-2):
            print(".", end="")
        print("


def main():
    array = []
    while True:
        value = input().split()
        value = [int(x) for x in value]
        if value[0] == 0 and value[1] == 0:
            break
        else:
            array.append(value)

    for i in range(0, len(array)):
        out_calc(array[i][1])
        in_calc(array[i][0], array[i][1])
        out_calc(array[i][1])
        print("")


if __name__ == '__main__':
    main()

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

Solution (Python):

while(True):
	h, w = [int(x) for x in input().split()]
	
	if (h == 0) and (w==0):
		break
		
	for i in range(1, h+1):
		if (i==1) or (i==h):
			print("
		else:
			print("{}{}{}".format("
	print()

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

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

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

Solution (Python):
h = []
w = []

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

k = 0

while k != len(h):
    for i in range(h[k]):
        for j in range(w[k]):
            if j == 0 or j == (w[k]-1) or i == 0 or i == (h[k]-1):
                print("
            else:
                print(".", end="")
        print("\n", end="")
    print("\n", end="")
    k += 1

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

Solution (Python):
import sys
def main():
    for line in sys.stdin:
        H, W = map(int, line.split())
        if H == 0 and W == 0:
            break
        else:
            for x in range(H):
                if x == 0 or x == H - 1:
                    for y in range(W):
                        print("
                    print()
                else:
                    for y in range(W):
                        if y == 0:
                            print("
                        elif y == W - 1:
                            print("
                        else:
                            print(".", end = "")
            print()



if __name__ == "__main__":
    main()

Solution (Python):
import sys

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

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

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

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

Solution (Python):
import sys
lines=sys.stdin.readlines()
for line in lines:
    H,W=map(int,line.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
 else:
  print(W*'
  for i in range(H-2):
   print('
  print(W*'

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

main()

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

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

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

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

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

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

    for i in range(1, H+1):
        for j in range(1, W+1):
            if i == 1 or i == H or j == 1 or j == W:
                c = '
            else:
                c = '.'
            print(c, end='')
        print('')
    print('')

Solution (Python):
import sys

def main():
    lines = sys.stdin.readlines()



    for line in lines:
        if len(line) == 0:
            continue
        
        
        line = line.strip('\n')
        elems = line.split(" ")
        
        last_width_index = int(elems[1]) - 1
        last_height_index = int(elems[0]) - 1
        

        if elems[0] == "0" or elems[1] == "0":
            continue
        for height_ind in range(int(elems[0])):
            width_str = ""
            for width_ind in range(int(elems[1])):
                if height_ind != 0 and height_ind != last_height_index and width_ind != 0 and width_ind != last_width_index:
                    width_str = width_str + "."
                else:
                    width_str = width_str + "

            print width_str
        print("")

if __name__ == "__main__":
    main()

Solution (Python):

"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_5_B&lang=jp

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    while True:
        H, W = map(int, input().split())
        if H == 0 and W == 0:
            break

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


if __name__ == '__main__':
    main(sys.argv[1:])

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

Solution (Python):



import math

def main():
    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)):
                    for j in range(b):
                        print('
                    print('')
                else:
                    for j in range(b):
                        if (j == 0 or j == (b-1)):
                            print('
                        else:
                            print('.', end='')
                    print('')

            print('')

if __name__ == '__main__':
    main()

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

Solution (Python):
import sys
w=""
a=[]
while (w!="0 0"):
    w=input()
    a.append(w)
a.pop()
for st in a:
    b=st.split()
    h=int(b[0])
    w=int(b[1])
    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")
    sys.stdout.write("\n")

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

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

if __name__ == "__main__":
    main()

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

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

Solution (Python):
while True:
    a = list(map(int, input().split()))
    if a[0] == a[1] == 0:
        break
    sharp1 = '
    sharp2 = '
    print(sharp1)
    for i in range(a[0] -2):
        print(sharp2)
    print(sharp1)
    print()

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

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

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

Solution (Python):
while 1:
 h,w=map(int,input().split())
 if h==0:break
 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):
import math
H,W = map(int,input().split())

while (H!=0 or W!=0):
    for i in range(H):
        if(i==0 or i==H-1):
            print(W*"
        else:
            print("
            
    print()
    H,W = map(int,input().split())

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):
class square():
    
    def __init__(self, x,y):
        self.x = x
        self.y = y
        
    def draw(self):
        
        for i in range(0,self.x):
            for j in range(0,self.y):
                if i == 0 or i == self.x-1 or j == 0 or j == self.y-1: 
                    print('
                else:
                    print('.',end="")
            print('') 
        print('')
        
    
while True:
    H,W = map(int,input().split())
    
    if H == 0 and W == 0:
        break
        
    s = square(H,W)
    s.draw()

Solution (Python):
while True:
    l = input().split()
    h = int(l[0])
    w = int(l[1])
    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(0,H):
        if i==0 or i==H-1:
            print("
        else:
            print("
    print()

Solution (Python):
import sys

class Rect():
    def __init__(self,w,h):
        self.w = w
        self.h = h

    def draw(self):
        for i in range(self.w):
            for j in range(self.h):
                if (i == 0 or i == self.w - 1) or (j == 0 or j == self.h - 1):
                    sys.stdout.write("
                else:
                    sys.stdout.write(".")
            sys.stdout.write("\n")
        sys.stdout.write("\n")

def main():
    data = []
    while 1:
        n = input().split()
        w = int(n[0])
        h = int(n[1])

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

        data.append(Rect(w,h))

    for num in data:
        num.draw()

if __name__ == "__main__":
    main()

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

Solution (Python):

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

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

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

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

Solution (Python):
hight = []
width = []
num = 0

while True:
    H,W = list(map(int,input().split()))
    if H==0 and W==0:
      break
    else:
      hight.append(H)
      width.append(W)
      num += 1

for i in range(num):
    for j in range(1,hight[i]+1):
      if j==1 or j==hight[i]:
        for k in range(width[i]):
           print("
        print("")
      else:
        for k in range(1,width[i]+1):
            if k==1 or k==width[i]:
              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("."*(W-2),end="")
        print("
    print("

    print("")

Solution (Python):
while True:
    a,b=map(int,input().split())
    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:
    arr = input().split()
    H = int(arr[0])
    W = int(arr[1])

    if H == 0 and W == 0:
        break
    else:
        edge = ''
        for i in range(W):
            edge += '

        inner = ''
        for i in range(W):
            if i == 0 or i == W - 1:
                inner += '
            else:
                inner += '.'

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

Solution (Python):
def build_line(width, i, h):
    s = ''
    if i == 0 or i == h-1:
        while len(s) < width:
                s += '
    else:
        s += '
        while len(s) < width - 1:
            s += '.'
        s += '
    return s

while True:
    h,w = [int(i) for i in input().split()]
    if not (h and w):
        break
    for i in range(h):
        print(build_line(w, i, h))
    print()

Solution (Python):
while True:
    H, W = map(int, input().split())
    if (H, W) == (0, 0):
        break
    a = "
    b = "
    print(a)
    print(b * (H - 2), end="")
    print(a + "\n")

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

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

Solution (Python):
def printfull(x):
	l = ''
	for _ in range(x):
		l += '
	return l

def printmid(x):
	l = ''
	for i in range(x):
		if i == 0 or i == x-1:
			l+= '
		else:
			l+= '.'
	return l
		
while True:
	try:
		line = input()
		if line != '0 0':
			dim = line.split(' ')
			dim = list(map(int, dim))
			
			for i in range(dim[0]):
				if i ==0 or i == dim[0]-1:
					print(printfull(dim[1]))
				else:
					print(printmid(dim[1]))
			print('')
			
		else:
			break
		
	except EOFError:
		break

Solution (Python):
while True:
    h,w = [int(x) for x in input().split( )]
    if h == w == 0:
        break
    else:
        print('
        for i in range(h-2):
            print('{0}{1}{0}'.format('
        print('
        print('')

Solution (Python):
from __future__ import print_function
while(1):
    x = raw_input()
    if(x == "0 0"):
        break
    x = x.split(" ")
    h = int(x[0])
    w = int(x[1])
    for j in range(0,w):
        print("
    print("\n",end="")
    for i in range(0,h-2):
        print("
        for k in range(0,w-2):
            print(".", end="")
        print("
    for l in range(0,w):
        print("
    print("\n",end="")
    print("\n",end="")

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):
from sys import stdin
for line in stdin:
    a, b = map(int, line.strip('\n').split(' '))
    if a == 0 and b == 0:
        break
    print('\n'.join(['

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

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

Solution (Python):
buffer = []
while True:
    x,y = map(int, input().split())
    if x==0 and y==0:
        break
    buffer.append([x,y])
for n in range(len(buffer)):
    for r in range(buffer[n][0]):
        if r == 0 or r == buffer[n][0]-1:
            print('
        else:
            if buffer[n][1]>2:
                print('
            if buffer[n][1]<=2:
                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 == W == 0: break
    print("
    for i in range(H-2):
        print("
    print("
    print()