import java.io.*;
import java.util.*;

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        }
    }
} import java.io.*; io.* java import java.util.*; util.* java class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        }
    }
} Main public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        }
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        } true {
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        } String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int h = Integer.parseInt(str[0]); h Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int w = Integer.parseInt(str[1]); w Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 if(h == 0 || w == 0) break; h == 0 || w == 0 h == 0 h 0 w == 0 w 0 break; for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            } int i=0; int i=0; i 0 i<h i h i++ i++ i {
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            } {
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            } System.out.print("") System.out.print System.out System System.out "" for(int j=0; j<w-1; j++){
                    System.out.print("#");
                } int j=0; int j=0; j 0 j<w-1 j w-1 w 1 j++ j++ j {
                    System.out.print("#");
                } {
                    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.print("\n") System.out.print System.out System System.out "\n" String args[] args
import java.io.*;
import java.util.*;

class Main{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        while(true){
            //String s = br.readLine();
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int w = Integer.parseInt(str[1]);
            if(h == 0 || w == 0) break;
            for(int i=0;i<h; i++){
                System.out.print("");
                for(int j=0; j<w-1; j++){
                    System.out.print("#");
                }
                System.out.println("#");
            }
            System.out.print("\n");
            //System.out.println(h+" "+w);
        }
    }
}