Domagoj loves drawing horses at leisure. For a long time, he's been a proud member of social groups dealing with this subject. But Domagoj is a very special boy, so because of his drawing technique most people do not understand his masterpieces.
One of his most famous drawings is #define HORSE 42-42, also known as Ordinary Horse.
15 2 2 6 2 2 2 2 6 6 2 6 4 6 4 6 6 2 6 6 6 6 2 8 2 8 2 10 2 10 2 12 2 12 2 12 4 12 4 6 4 6 2 6 1 8 2 8 0 10 2 10 1 12 2 12 0 42 42 42 43 2 2 |
You must be wondering "Where is that horse?" and "Is everything all right with Domagoj?" because you only see some numbers on the drawing. The first question will be answered in the next section, while the answer to the second question also interests the author of this task.
In order to understand the drawing, you need to understand Domagoj's drawing technique. The first
number in the drawing is the number
Your task is to print a rectangular matrix #
if the point with the coordinates .
. Coordinate .
, i.e. it should be
minimal in size.
Input
In the first line of the input there is a positive integer
In the last line of the input there will be two non-negative integers
Output
Print required matrix
Scoring
In the test samples totally worth 30% of the points you should draw all line segments.
Sample Input 1
15
2 2 6 2
2 2 2 6
6 2 6 4
6 4 6 6
2 6 6 6
6 2 8 2
8 2 10 2
10 2 12 2
12 2 12 4
12 4 6 4
6 2 6 1
8 2 8 0
10 2 10 1
12 2 12 0
42 42 42 43
2 2
Sample Output 1
#####......
#...#......
#...#######
#...#.....#
###########
....#.#.#.#
......#...#
Explanation for Sample Output 1
In the first example all the line segments should be drawn except the last.
Sample Input 2
6
1 1 10 1
10 1 10 3
10 3 1 3
1 3 1 1
10 3 11 3
11 3 11 6
2 1
Sample Output 2
..........#
..........#
..........#
###########
#........#.
##########.
Explanation for Sample Output 2
In the second example all the line segments should be drawn to get the drawing of the name "Summarized horse".
Comments