405160: GYM101807 L Labyrinth

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

Description

L. Labyrinthtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Hackerland's Theme Park has an exciting attraction: a labyrinth that can be treated as a $$$3 \times W$$$ grid. It has three special squares: $$$A = (1, a)$$$, $$$B = (3, b)$$$, and $$$X = (2, 1)$$$. Two players will start at $$$A$$$ and $$$B$$$ respectively and will try to reach $$$X$$$ as quickly as possible. In one step, a person can move one square up, down, left, or right. It is possible for both of them to be located at the same square at the same time.

For convenience, let $$$dist(U, V)$$$ denote the distance between squares $$$U$$$ and $$$V$$$, i.e. the number of steps needed to reach $$$V$$$ from $$$U$$$. If $$$V$$$ is not reachable from $$$U$$$, then $$$dist(U, V) = \infty$$$.

You are concerned that the game may be unfair, if $$$dist(A, X) \neq dist(B, X)$$$. Therefore, you are going to place some (possibly zero) obstacles at some of the squares, so that $$$dist(A, X) = dist(B, X) < \infty$$$.

Originally, the grid has no obstacles. You cannot add obstacles to squares $$$A$$$, $$$B$$$, and $$$X$$$. Find a way to create a fair labyrinth!

Input

The first and only line of input consists of three space-separated integers $$$W$$$, $$$a$$$, and $$$b$$$.

For all test cases, $$$1 \le a, b \le W \le 100$$$.

Output

If there is no way of adding obstacles so that $$$dist(A, X) = dist(B, X) < \infty$$$, output Impossible.

Otherwise, output Possible followed by three lines. Output $$$W$$$ characters on each of the next three lines. The $$$j$$$-th character of the $$$i$$$-th line should be:

  • A (ASCII 65), if $$$(i, j) = A$$$;
  • B (ASCII 66), if $$$(i, j) = B$$$;
  • X (ASCII 88), if $$$(i, j) = X$$$;
  • * (ASCII 42), if $$$(i, j)$$$ is none of $$$A, B, X$$$ and an obstacle is placed at $$$(i, j)$$$;
  • . (ASCII 46), if $$$(i, j)$$$ is none of $$$A, B, X$$$ and no obstacle is placed at $$$(i, j)$$$.

If there are multiple solutions, output any one of them.

ExamplesInput
1 1 1
Output
Possible
A
X
B
Input
4 3 2
Output
Impossible
Input
3 3 1
Output
Impossible
Input
9 3 7
Output
Possible
**A....**
X.**...**
.....*B**

加入题单

算法标签: