import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	}

}
 import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	}

} Main public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	} main {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[][] ty = new int[10000][2]; ty new int[10000][2] 10000 2 int t = 1; t 1 int y = 1; y 1 int count = 0; count 0 for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		} int i = 0; int i = 0; i 0 t != 0 || y != 0 t != 0 t 0 y != 0 y 0 i++ i++ i {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		} {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		} String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String[] HW = line.split(" "); HW line.split(" ") line.split line " " t = Integer.parseInt(HW[0]) t Integer.parseInt(HW[0]) Integer.parseInt Integer HW[0] HW 0 y = Integer.parseInt(HW[1]) y Integer.parseInt(HW[1]) Integer.parseInt Integer HW[1] HW 1 ty[i][0] = t ty[i][0] ty[i] ty i 0 t ty[i][1] = y ty[i][1] ty[i] ty i 1 y count++ count for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		} int i = 0; int i = 0; i 0 i < count-1 i count-1 count 1 i++ i++ i {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		} {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		} StringBuilder x = new StringBuilder(); x new StringBuilder() for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			} int j = 0; int j = 0; j 0 j < ty[i][1] j ty[i][1] ty[i] ty i 1 j++ j++ j {

				x.append("#");


			} {

				x.append("#");


			} x.append("#") x.append x "#" String z = x.toString(); z x.toString() x.toString x StringBuilder a = new StringBuilder(); a new StringBuilder() for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			} int j = 0; int j = 0; j 0 j < ty[i][1] j ty[i][1] ty[i] ty i 1 j++ j++ j {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			} {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			} if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				} j == 0 || j== ty[i][1]-1 j == 0 j 0 j== ty[i][1]-1 j ty[i][1]-1 ty[i][1] ty[i] ty i 1 1 {
					a.append("#");
				} a.append("#") a.append a "#" {
					a.append(".");
				} a.append(".") a.append a "." String b = a.toString(); b a.toString() a.toString a for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			} int j = 0; int j = 0; j 0 j < ty[i][0] j ty[i][0] ty[i] ty i 0 j++ j++ j {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			} {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			} if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				} j == 0 || j== ty[i][0]-1 j == 0 j 0 j== ty[i][0]-1 j ty[i][0]-1 ty[i][0] ty[i] ty i 0 1 {
					System.out.println(z);
				} System.out.println(z) System.out.println System.out System System.out z {
					System.out.println(b);
				} System.out.println(b) System.out.println System.out System System.out b System.out.println("") System.out.println System.out System System.out "" String[] args args public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	}

} public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	}

} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int[][] ty = new int[10000][2];
		int t = 1;
		int y = 1;

		int count = 0;

		for (int i = 0; t != 0 || y != 0; i++) {

			String line = sc.nextLine();
			String[] HW = line.split(" ");
			t = Integer.parseInt(HW[0]);
			y = Integer.parseInt(HW[1]);
			ty[i][0] = t;
			ty[i][1] = y;

			count++;

		}

		for (int i = 0; i < count-1; i++) {



			//ここを分岐させる
			StringBuilder x = new StringBuilder();
			for (int j = 0; j < ty[i][1]; j++) {

				x.append("#");


			}

			String z = x.toString();


			StringBuilder a = new StringBuilder();

			for (int j = 0; j < ty[i][1]; j++) {
				if (j == 0 || j== ty[i][1]-1) {
					a.append("#");
				}else{
					a.append(".");
				}

			}


			String b = a.toString();



			for (int j = 0; j < ty[i][0]; j++) {
				if (j == 0 || j== ty[i][0]-1) {
					System.out.println(z);
				} else {
					System.out.println(b);
				}

			}
			System.out.println("");


		}

	}

}

