402808: GYM100886 C Black and White Board

Memory Limit:0 MB Time Limit:5 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

C. Black and White Boardtime limit per test5 secondsmemory limit per test256 mebibytesinputstandard inputoutputstandard output

You are given a chessboard of size n × m. The cells are painted black and white such that the cell (1, 1) is white, and any two adjacent cells have different color. Some cells of the chessboard are banned.

Your task is to find a connected figure on the chessboard which does not contain banned cells and contains exactly w white cells and b black cells. Two cells are adjacent if they share a side.

Input

The first line contains three integers n, m and k (1 ≤ n, m ≤ 10, 0 ≤ k ≤ n·m): the number of rows of the chessboard, the number of columns of the chessboard and the number of banned cells.

The following k lines contain the coordinates of banned cells. Each of these lines contains a pair of integers xi and yi (1 ≤ xi ≤ n, 1 ≤ yi ≤ m): the coordinates of a banned cell. All banned cells are distinct.

The last line contains two integers w and b (0 ≤ w, b ≤ n·m, w + b > 0).

Output

If it is impossible to find a connected figure without banned cells with w white cells and b black cells, print a single line containing ":-(" without quotes.

Otherwise, print n lines containing m characters each which describe the figure. The lines must consist of characters "O", "X" and ".":

  • character "O" means a white cell which is included in the desired figure,
  • character "X" means a black cell which is included in the desired figure,
  • character "." means a cell which is not included in the desired figure.
If there are several possible answers, print any one of them.ExamplesInput
3 4 2
2 2
2 3
3 3
Output
....
X..O
OXOX

Input
8 10 1
1 5
19 9
Output
..........
..X...XOX.
..O...O...
..XO.OXO..
..O.O.O.O.
.OXOXOXOXO
..O.O.O.O.
..........

加入题单

算法标签: