import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    } main {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        } true {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        } int h = sc.nextInt(); h sc.nextInt() sc.nextInt sc int w = sc.nextInt(); w sc.nextInt() sc.nextInt sc if (h == 0 && w == 0)
                break; h == 0 && w == 0 h == 0 h 0 w == 0 w 0 break; char rect[][] = new char[h][w]; rect new char[h][w] h w for (char[] e : rect)
                Arrays.fill(e, '#'); char[] e rect Arrays.fill(e, '#'); Arrays.fill(e, '#') Arrays.fill Arrays e '#' int h2 = h - 2; h2 h - 2 h 2 int w2 = w - 2; w2 w - 2 w 2 for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.'; int x = 0; int x = 0; x 0 x < w2 x w2 x++ x++ x for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.'; for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.'; int y = 0; int y = 0; y 0 y < h2 y h2 y++ y++ y rect[y+1][x+1] = '.'; rect[y+1][x+1] = '.' rect[y+1][x+1] rect[y+1] rect y+1 y 1 x+1 x 1 '.' for (char[] e : rect)
                System.out.println(e); char[] e rect System.out.println(e); System.out.println(e) System.out.println System.out System System.out e 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);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (true) {
            int h = sc.nextInt();
            int w = sc.nextInt();

            if (h == 0 && w == 0)
                break;

            char rect[][] = new char[h][w];
            for (char[] e : rect)
                Arrays.fill(e, '#');

            int h2 = h - 2;
            int w2 = w - 2;
            for (int x = 0; x < w2; x++)
                for (int y = 0; y < h2; y++)
                    rect[y+1][x+1] = '.';

            for (char[] e : rect)
                System.out.println(e);
            System.out.println();
        }
    }
}