Paint By Numbers

aka Nonograms, Crucipixel, Logic Art or a million other names.

Run 4

Input

3
5
1
1.2
1.5
1.2.1
1
1.2.1
-
2.1
1
1.2.1
2.3.1
2.1
5
1.3.1

Expected Output

   XXX
  XXXXX
     X
   X XX
X XXXXX
X XX  X
 X
X XX  X