Under construction

Still being built. Things may change

ASCII Art

Interview

Time limit1sMemory limit512 MB

Summary
Given up to 5000 integer points, draw them as 'x' marks on ASCII axes inside the smallest rectangular '#' frame, with '-' and '|' filling empty axis cells and 'o' for the origin.
Level

Medium4 of 10

Topics
Implementation, Matrix, Simulation
Solved
No attempts yet

Problem

Mr. Malnar is a passionate lover of art and the urban culture of the city of Zagreb, so it is no surprise that he is a regular guest at the Art Park event year after year, which this year was held in Ribnjak Park. Interestingly, he got the inspiration for this task right there. While browsing the masterpieces of the exhibition "Cowboys, Guns, and Feminism," he met a young woman.

Mr. Malnar: Do you notice how contemporary artists very rarely reach for the ASCII art technique?

Woman: I must admit I am not familiar with that technique. What exactly is it about?

Mr. Malnar: It is a technique by which artists depict very complex images using 128 characters defined by the ASCII standard. If you want, I will show you some of my works, and along the way I could also treat you to a hop juice.

Woman: That sounds interesting, sure!

In the plane, n integer points are highlighted, and your task is to draw them in the coordinate system using the ASCII art technique.

Each highlighted point in the image must be represented by the character 'x' (ASCII 120). If the origin of the coordinate system is not among the highlighted points, then it must be represented by the character 'o' (ASCII 111). Also, the parts of the coordinate axes on which no highlighted points lie must be represented by special characters. More precisely, such parts of the x-axis must be represented by the character '-' (ASCII 45), and such parts of the y-axis must be represented by the character '|' (ASCII 124). The remaining parts of the plane on which no highlighted point, origin, or coordinate axis lies must be represented by the space character ' ' (ASCII 32).

Additionally, the entire image must be placed in a rectangular frame of the smallest possible area, whose border in the image must be marked with the character '#' (ASCII 35). Of course, all highlighted points together with the origin must be inside the frame.

Notice that these requirements uniquely determine the appearance of the image.

Input

The first line contains the positive integer n (1 ≤ n ≤ 5 000) from the problem text.

In the i-th of the following n lines there are two integers xi and yi (−500 ≤ xi, yi ≤ 500) representing the coordinates of the i-th highlighted point. Each point will appear in the input at most once.

Output

Output the ASCII art image of the coordinate system with the highlighted points as described in the problem text.

Examples3

  1. Example 1

    Input
    2
    1 1
    -3 -1
    
    Expected output
    #######
    #   |x#
    #---o-#
    #x  | #
    #######
    
  2. Example 2

    Input
    6
    -5 0
    -3 0
    -1 0
    1 0
    3 0
    5 0
    
    Expected output
    #############
    #x-x-xox-x-x#
    #############
    
  3. Example 3

    Input
    20
    -1 1
    -1 2
    -1 3
    -2 2
    -2 4
    -3 2
    -3 4
    -4 1
    -4 2
    -4 3
    1 -1
    1 -2
    1 -3
    1 -4
    2 -1
    2 -4
    3 -1
    3 -4
    4 -1
    4 -4
    
    Expected output
    ###########
    # xx |    #
    #x  x|    #
    #xxxx|    #
    #x  x|    #
    #----o----#
    #    |xxxx#
    #    |x   #
    #    |x   #
    #    |xxxx#
    ###########