var fs, max, scale, max_log2, max_pow2, series;

fs = require('fs');

max = 300;

function log2(n) {
	return n.toString(2).length - 1;
}

max_log2 = Math.floor(log2(max));
max_pow2 = Math.pow(2, max_log2);

series = function(max_pow2) {
	var i, series = [];
	for (i = max_pow2; i >= 1; i /= 2) series.push(i);
	return series;
} (max_pow2);

scale = function(max) {
	var scale, i, str;
	scale = [];
	str = "#";
	for (i = 1; i < max; i *= 2) {
		scale.push(str);
		str = str + str;
	}
	return scale.reverse();
}(max);

function get_column(W) {
	var i, res, rest;
	res = "";
	rest = W;
	for (i in series) {
		if (rest >= series[i]) {
			rest -= series[i];
			res = res + scale[i];
		}
	}
	return res;
}

function repeat(str, n) {
	return get_column(n).replace(/#/g, str);
}

function main() {
	var line, i, hw, end_i;
	line = fs.readFileSync('/dev/stdin', 'ascii').split("\n");
	end = false;
	for (i in line) {
		hw = line[i].split(' ', 2).map(Number);
		if (hw[0] === 0 && hw[1] === 0) {
			end_i = Number(i);
			break;
		}
		line[i] = repeat(get_column(hw[1]) + "\n", hw[0]) + "\n";
	}
	line.length = end_i;
	console.log(line.join("").trim());
}

main();