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):
x=[]
y=[]
count=0
while True:
    i,j=map(int,raw_input().split())
    if (i,j)==(0,0):
        break
    count+=1
    x.append(i)
    y.append(j)

for i in range(count):
    print('
    for j in range(x[i]-2):
        print('
    if x[i]!=1:    
        print('
    print('')

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

Solution (Python):


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

Solution (Python):
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:
    h, w = map( int, input().split() )
    if not h and not w:
        break
    if h <3 or w < 3:
        print(("
    else:
        print('

Solution (Python):
while True:
    [h,w] = map(int,input().split())
    if h==0 and w ==0: break
    s = ['
    t = list(filter(lambda x: x!='', s))
    print(''.join(t[0:h]))

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):
h = 0
w = 0
dataset = []

while True:
    h, w = map(int, input().split())
    if (h >= 3 and h <= 300) and (w >= 3 and w <= 300):
        listed = []
        listed.append(h)
        listed.append(w)
        dataset.append(listed)
    elif h == 0 and w == 0:
        break
    else:
        break

for listed in dataset:
    h = listed[0]
    w = listed[1]

    for i in range(0, 1):
        for j in range(w):
            print("
        print()
    for i in range(1, h-1):
        for j in range(0, 1):
            print("
        for j in range(1, w-1):
            print(".", end="")
        for j in range(w-1, w):
            print("
        print()
    for i in range(h-1, h):
        for j in range(w):
            print("
        print()
    print()

Solution (Python):
dataset = []

while True:
    h, w = map(int, input().split())
    if (h >= 3 and h <= 300) and (w >= 3 and w <= 300):
        listed = []
        listed.append(h)
        listed.append(w)
        dataset.append(listed)
    elif h == 0 and w == 0:
        break
    else:
        break

for listed in dataset:
    h = listed[0]
    w = listed[1]

    for i in range(0, 1):
        for j in range(w):
            print("
        print()
    for i in range(1, h-1):
        for j in range(0, 1):
            print("
        for j in range(1, w-1):
            print(".", end="")
        for j in range(w-1, w):
            print("
        print()
    for i in range(h-1, h):
        for j in range(w):
            print("
        print()
    print()

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

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

Solution (Python):
'''
ITP-1_5-B
 ?????¬???????????????
??\????????????????????????H cm ?????? W cm ???????????????????????°?????????????????????????????????






?????????????????? 6 cm ?????? 10 cm ???????????¨??????????????????
???Input
??\???????????°????????????????????????????§???????????????????????????????????????????????????¢????????\????????¨????????§??????
H W
H, W ?????¨?????? 0 ?????¨????????\?????????????????¨????????????
???Output
?????????????????????????????????????????? H cm ?????? W cm ?????????????????????????????????
?????????????????????????????????????????????????????\??????????????????
'''

import sys

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

Solution (Python):
while True:
    h, w = map(int, input().strip().split())
    if h == w == 0:
        break
    elif h > 2 and w > 2:
        print('
    else:
        print(('

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

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


            print()
        print()

Solution (Python):
import sys
for l in sys.stdin:
  H, W = map(int,l.split())
  if H == 0 and W == 0:
    break
  for i,h in enumerate(range(H)):
      if i != 0 and i!=H-1:
          print ('
      else:
          print ('
  print ('')

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

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

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

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

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

Solution (Python):
import sys
while 1:
	H,W=map(int,raw_input().split())
	if H==0 and W==0:
		break;
	else:
		for h in range(H):
			for w in range(W):
				if h == 0 or w == 0 or h == H-1 or w == W-1 :
					sys.stdout.write('
				else:
					sys.stdout.write('.')

			sys.stdout.write('\n')
	sys.stdout.write('\n')

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 sys


def string_to_list_spliter():
    h, w = [int(i) for i in sys.stdin.readline().split()]
    return h, w


def generate_frame(h, w):
    frame = ''
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h-1:
                frame += '
            else:
                if j == 0 or j == w-1:
                    frame += '
                else:
                    frame += '.'
        frame += '\n'
    return frame


def print_frame():
    while True:
        h, w = string_to_list_spliter()
        if h == 0 and w == 0:
            break
        print(generate_frame(h, w))


def main():
    print_frame()


if __name__ == '__main__':
    main()

Solution (Python):


import sys


def string_to_list_spliter():
    h, w = [int(i) for i in sys.stdin.readline().split()]
    return h, w


def generate_frame(h, w):
    frame = ''
    for i in range(h):
        for j in range(w):
            if i == 0 or i == h-1:
                frame += '
            else:
                if j == 0 or j == w-1:
                    frame += '
                else:
                    frame += '.'
        frame += '\n'
    return frame


def print_frame():
    while True:
        h, w = string_to_list_spliter()
        if h == 0 and w == 0:
            break
        print(generate_frame(h, w))


def main():
    print_frame()


if __name__ == '__main__':
    main()

Solution (Python):


while True:
	buff = input().split()
	h = int(buff[0])
	w = int(buff[1])
	if w == h == 0:
		break
	for i in range(h):
		if i == 0 or i == h-1:
			for j in range(w):
				print("
		else:
			for j in range(w):
				if j == 0 or j == w-1:
					print("
				else:
					print(".", end = "")
		print()
	print()

Solution (Python):
def print_frame(h, w):
    """
    h: int(3 <= h <= 300)
    w: int(3 <= w <= 300)
    outputs a rectangle frame h x w

    >>> print_frame(3, 4)
    
    
    
    >>> print_frame(5, 6)
    
    
    
    
    
    >>> print_frame(3, 3)
    
    
    
    """
    print('
    for i in range(h-2):
        print('
    print('


if __name__ == '__main__':

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

Solution (Python):
while 1:
    h,w = map(int,input().split())
    if h == 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
    a = [["
    b = ["".join(a[i]) for i in range(H)]
    print(b[0])
    coma = ["."for i in range(W-2)]
    coma = "".join(coma)
    for i in range(H-2):
        print("
    print(b[H-1])
    print()

Solution (Python):

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

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

Solution (Python):
while True:
    height, width = [int(x) for x in input().split(" ")]
    if height == 0 and width ==0:
        break

    
    print("{0}".format("
    for h in range(0, (height - 2)):
        for w in range(width):
            if w == 0 or w == (width - 1):
                print ("
            else:
                print (".", end="")
        print("\n", end="")


    
    print("{0}".format("

    print("\n", end="")

Solution (Python):
if __name__ == "__main__":
    while True:
        h,w = map(int,input().split())
        if w is not 0 or h is not 0:
            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("")
        else:
            break

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:
				print("
			else:
				if j == 0 or j == W-1: 
					print("
				else:
					print(".", end='')
		print("\n", end='')
	print("\n", end='')

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:
    a=[int(x) for x in input().split()]
    if a[0]==a[1]==0:
        break
    else:
        print("
        for i in range(a[0]-2):
            print("
        print("
    print("")

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

Solution (Python):
while True:
    H, W = [int(x) for x in input().split() if x.isdigit()]
    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
num = []
for i in sys.stdin:
    H, W = i.split()
    if H == W == '0':
        break
    num.append((int(H), int(W)))

for cnt in range(len(num)):
    for h in range(num[cnt][0]):
        for w in range(num[cnt][1]):
            if w == 0 or w == num[cnt][1] - 1 or h == 0 or h == num[cnt][0] - 1:
                print('
            else:
                print('.',end='')
        print()
    print()

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

    print()

Solution (Python):
array = []
while True:
    n = input()
    if n == "0 0":
        break
    array.append(n.split())
for i in range(len(array)):
    for i2 in range(int(array[i][0])):
        for i3 in range(int(array[i][1])):
            if i3 == int(array[i][1])-1:
                print("
            else:
                if i2 != 0 and i2 !=  int(array[i][0])-1:
                    if i3 != 0:
                        print(".",end="")
                    else:
                        print("
                else:
                    print("
    print("")

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

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

Solution (Python):


import sys
import os


def frame(w, h):
    top = '

    inner = ['.'] * w
    inner[0] = '
    inner[-1] = '
    inner_str = ''.join(inner)

    print(top)
    for i in range(h - 2):
        print(inner_str)
    print(top)


for s in sys.stdin:
    H, W = list(map(int, s.split()))
    if W == H == 0:
        break
    else:
        frame(W, H)
        print()

Solution (Python):


list = []

while True:
    num = input().rstrip().split(" ")
    if (int(num[0]) == 0) and (int(num[1]) == 0):
        break
    list.append(num)

for i in range(len(list)):
    for j in range(int(list[i][0])):
        if (j == 0) or (j == (int(list[i][0])-1)):
            print("
        else:
            print("
    print()

Solution (Python):
while True:
    H,W = map(int,input().split())
    if 3 <= H and W <= 300:
        print(W * ('
    if H == W == 0:
        break
    print()

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

Solution (Python):
H=1
W=1
while H!=0 or W!=0:
	H,W = [int(i) for i in input().split()]
	if H!=0 or W!=0:
		for i in range(W):
			print('
		print()
		for i in range(H-2):
			print('
			for j in range(W-2):
				print('.',end='')
			print('
		for i in range(W):
			print('
		print('\n')

Solution (Python):
while 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):
import sys
for i in sys.stdin.readlines(): 
    nums = list(map(int,i.split()))
    h = nums[0]
    w = nums[1]
    if h == 0 and w == 0:
        break
    for j in range(1,h+1):
        if j == 1 or j == h:
            print("
        else:
            print("
    print("")

Solution (Python):
while True:
    H,W= map(int, input().split())
    if H==0 and W==0:
        break
    s = "
    a = H
    b = "."
    for i in range(H):
        if 1<a<H:
            y = s+b*(W-2)+s
            print(y)
            a-=1
        elif a==H or a==1:
            x = s*W
            print(x)
            a-=1                    
    print("")

Solution (Python):


 
def func():
    data=[]
    while(True):
        try:
            [height,width] = [ int(item) for item in input().rstrip().split(" ") ]
        except:
            return inputError()
         
        if( (height > 0) and (width > 0) ):
            data.append([height,width])
        elif( (height == 0) and (width == 0) ):
            break
        else:
            return inputError()
    
    result=""
    for item in data:
        [height,width]=item
        for i in range(height):
            if( (i==0) or (i==height-1) ):
                result+="
            elif(width<3):
                result+="
            else:
                result+="
        result+="\n"
    
    print(result[:-1])
        
def inputError():
    print("input Error")
    return -1
 
func()

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
  rect='
  rect+=('
  rect+='
  print(rect)

Solution (Python):
rectArray = []

h, w = input().split()
h = int(h)
w = int(w)

while h != 0 and w != 0:
    rectArray.append([h, w])
    h, w = input().split()
    h = int(h)
    w = int(w)

for x in rectArray:
    for i in range(x[0]):
        for j in range(x[1]):
            if i == 0 or j == 0 or i == x[0] - 1 or j == x[1] - 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 i in range(H):
        if i == 0 or i == (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'
		else:
			print'
	print

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

Solution (Python):

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

Solution (Python):
from sys import stdin

for line in stdin:
    H, W = map(int, line.rstrip().split(' '))
    if 0 == H == W:
        break

    print('

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

    print('
    print()

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

Solution (Python):
H,W = map(int, input().split())
L = []
while H != 0 or W != 0:
 L.append([H, W])
 H,W = map(int, input().split())

def draw(H,W):
 print("
 for i in range(H-2):
  print("
 print("
 print("")

for (H, W) in L:
 draw(H,W)

Solution (Python):



while 1 :
    try:
        h,w=map(int,input().split())
        
        if( h==0 and w==0 ): 
            break
        else:
            for hi in range(h):
                out=""
                if (hi==0 or hi==h-1):
                    out+="
                else :
                    for wi in range(w):
                        if(wi==0 or wi==w-1): out+="
                        else: out+="."
                print(out)
            print()
        if( h==0 and w==0 ): break
    except (EOFError):
        
        break

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

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

Solution (Python):

while True:
    H, W = map(int, input().split())
    if not(H or W):
        break
    for j in range(W):
        print('
    print()
    for i in range(H-2):
        print('
        for j in range(W-2):
            print('.', end='')
        print('
    for j in range(W):
        print('
    print('\n')

Solution (Python):
while True:
    H, W = map(int, input().split())
    if not(H or W):
        break
    for j in range(W):
        print('
    print()
    for i in range(H-2):
        print('
        for j in range(W-2):
            print('.', end='')
        print('
    for j in range(W):
        print('
    print('\n')

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 j == 0 or j == W - 1 \
            or i == 0 or i == H - 1:
                print("
            else:
                print(".", end="")
        print()
    print()

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

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

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

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

Solution (Python):
while True:
    s = input().split(" ")
    H = int(s[0])
    W = int(s[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:
                print("
            else:
                if j == 0 or j == W-1:
                    print("
                else:
                    print(".",end="")
        print("")
    print("")

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

Solution (Python):

h = 1
w = 1

while h+w != 0:
    h, w=input().rstrip().split(" ")
    h = int(h)
    w = int(w)
    if h == 0:
        if w==0:
            break

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

    print("
    print("")

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

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

Solution (Python):
figure = ''
height, width = [int(x) for x in input().split()]
while height or width:
    side = ('
    fill = '
    rect = side + (fill * (height-2)) + side
    figure += rect + '\n'
    height, width = [int(x) for x in input().split()]
  
print(figure[:-1])

Solution (Python):
judge = True

while judge:
    h,w = map(int, input().split(" "))
    if h == 0 and w == 0:
        judge = False
    else:
        for i in range(h):
            if i == 0 or i+1 == h:
                print("
            else:
                print("
        print()

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

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

            if w == W - 1:
                print()
    print()

Solution (Python):

loop = 1
while(loop):
    l = input().strip().split()
    H = int(l[0])
    W = int(l[1])
    if(H == 0 and W == 0):
        break
    else:
        for y in (range(H)):
            for x in (range(W)):
                if(x == 0 or y == 0 or x == (W-1) or y == (H-1)):
                    print("
                else:
                    print(".",end="")
            print()
        print()

Solution (Python):


ar = []
while True:
  tmp = [int(i) for i in input().split()]
  if tmp == [0,0]:
    break
  else:
    ar.append(tmp)

for i in range(len(ar)):
  for j in range(ar[i][0]):
    for k in range(ar[i][1]):
      if j == 0 or j == ar[i][0] - 1 or k == 0 or k == ar[i][1] - 1:
        print('
      else:
        print('.' , end='' if k !=ar[i][1]-1 else '\n' if j != ar[i][0]-1 else '\n\n')

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

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

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

    print()

Solution (Python):
H = ''
W = ''
i = j = 0

while True:
  line = input()
  line = line.split()
  H = int(line[0])
  W = int(line[1])

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

  while i < H:
    if i == 0 or i == H-1:
      print('
    else:
      print('
      print('.'*(W-2),end='')
      print('
    i += 1
  i = 0
  print()

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

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

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

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

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

Solution (Python):
import sys

for line in sys.stdin:
  H, W = map(int, line.split())

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

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

  print("")

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

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

            print(w * "
        elif h==2:
            print(w * "
        print("")

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

    else:
        print('

        h2 = h-2
        w2 = w-2
        for i in range(0, h2):
            print('
        print('
        print('')

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

Solution (Python):
while True:
 H,W = map(int,input().split())
 if H==0 and W==0:
   break
 else:
   print('
   for s 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
    idx = ('
    con = ""
    if W > 2: con = ('
    if H >= 2: con  =con + idx
    print(idx + con)

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

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):
			if i == 0 or i == H-1:
				print("
			else:
				print("
		print("")