Олимпиадный тренинг

Задача 38324. herringbone


"Draw" using the characters on the forest screen. In this case, do not use commands to move the cursor around the screen. Your program must print the characters of the lines (or the entire line) sequentially.

Forest — it is one or more Christmas trees. Each Christmas tree is characterized by the number of triangles in it and the size of the smallest triangle. The herringbone consists of triangles whose vertices are strictly under each other, and each next triangle contains one line more than the previous one.

All Christmas trees should start vertically from the first line. Each Christmas tree should be located as far to the left as possible, while the Christmas trees should not touch (i.e. there should not be symbols depicting another Christmas tree near the symbols of the Christmas tree on the right, left, bottom, top, and also diagonally) and the order should not be violated Christmas trees.

Christmas trees should be depicted with the symbols «#» (lattice), and the empty spaces between them — symbols «.» (dot). All lines must display the same number of characters, and there must be a line in which the last character is a pound sign, the last line must contain hacks (i.e., a rectangle of dots and bars should be displayed, it should not contain extra columns and rows).

Input
The number of Christmas trees is entered N, and then N pairs of natural numbers describing the Christmas trees: the first number of each pair specifies the number of triangles in the Christmas tree, and the second — the size of the smallest triangle. The Christmas trees are described in order from left to right (if you look at the tops of the Christmas trees).

It is guaranteed that the input data will be such that the number of characters to be output in one line will not exceed 79.

Imprint
Output the required "drawing". See examples for better understanding.
 
Examples
# Input Output
1 2
3 2
3 3
...#......#....
..###....###...
...#....#####..
..###.....#....
.#####...###...
...#....#####..
..###..#######.
.#####....#....
#######..###...
........#####..
......#######.
......#########
2 3
1 1
2 1
3 2
#.#...#...
..#..###..
.###..#...
.....###..
....#####.
......#...
.....###..
....#####.
...#######