
import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int W,H;
for(;;){
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
}
}
} import java.util.*; util.* java class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int W,H;
for(;;){
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
}
}
} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int W,H;
for(;;){
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
}
} main {
Scanner sc = new Scanner(System.in);
int W,H;
for(;;){
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
}
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int W W H; H for(;;){
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
} ; {
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
} {
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
} H =sc.nextInt() H sc.nextInt() sc.nextInt sc W =sc.nextInt() W sc.nextInt() sc.nextInt sc if(H == 0) break; H == 0 H 0 break; for(int a=0; a<W; a++) System.out.print("#"); int a=0; int a=0; a 0 a<W a W a++ a++ a System.out.print("#"); System.out.print("#") System.out.print System.out System System.out "#" System.out.println() System.out.println System.out System System.out for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
} int c=2; int c=2; c 2 c<H c H c++ c++ c {
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
} {
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
} System.out.print("#") System.out.print System.out System System.out "#" for(int b=2; b<W; b++) System.out.print("."); int b=2; int b=2; b 2 b<W b W b++ b++ b System.out.print("."); System.out.print(".") System.out.print System.out System System.out "." System.out.println("#") System.out.println System.out System System.out "#" for(int a=0; a<W; a++) System.out.print("#"); int a=0; int a=0; a 0 a<W a W a++ a++ a System.out.print("#"); System.out.print("#") System.out.print System.out System System.out "#" System.out.println() System.out.println System.out System System.out System.out.println() System.out.println System.out System System.out String[] args args

import java.util.*;

class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int W,H;
for(;;){
H =sc.nextInt();
W =sc.nextInt();
if(H == 0) break;
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
for(int c=2; c<H; c++){
System.out.print("#");
for(int b=2; b<W; b++) System.out.print(".");
System.out.println("#");
}
for(int a=0; a<W; a++) System.out.print("#");
System.out.println();
System.out.println();
}
}
}