import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	}

}
 import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	}

} Main public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) StringTokenizer st=new StringTokenizer(br.readLine()); st new StringTokenizer(br.readLine()) int H=Integer.parseInt(st.nextToken()); H Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st int W=Integer.parseInt(st.nextToken()); W Integer.parseInt(st.nextToken()) Integer.parseInt Integer st.nextToken() st.nextToken st while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		} H!=0 || W!=0 H!=0 H 0 W!=0 W 0 {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		} int i=1; i 1 int j=0; j 0 while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			} j<H j H {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			} while(i<W) {
					System.out.print("#");
					i++;
				} i<W i W {
					System.out.print("#");
					i++;
				} System.out.print("#") System.out.print System.out System System.out "#" i++ i System.out.println("#") System.out.println System.out System System.out "#" i=1 i 1 j++ j System.out.println("") System.out.println System.out System System.out "" StringTokenizer sa=new StringTokenizer(br.readLine()); sa new StringTokenizer(br.readLine()) H=Integer.parseInt(sa.nextToken()) H Integer.parseInt(sa.nextToken()) Integer.parseInt Integer sa.nextToken() sa.nextToken sa W=Integer.parseInt(sa.nextToken()) W Integer.parseInt(sa.nextToken()) Integer.parseInt Integer sa.nextToken() sa.nextToken sa String[] args args public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	}

} public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	}

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		StringTokenizer st=new StringTokenizer(br.readLine());
		int H=Integer.parseInt(st.nextToken());
		int W=Integer.parseInt(st.nextToken());

		while(H!=0 || W!=0) {

			int i=1;
			int j=0;

			while(j<H) {
				while(i<W) {
					System.out.print("#");
					i++;
				}
				System.out.println("#");
				i=1;
				j++;
			}
			System.out.println("");
			StringTokenizer sa=new StringTokenizer(br.readLine());
			H=Integer.parseInt(sa.nextToken());
			W=Integer.parseInt(sa.nextToken());

		}
	}

}

