Galou is Back!

No attempts yetTime limit1sMemory limit128 MB

Problem

The famous witch is back. After slaying an incredible number of monsters to find a hidden treasure, Zak Galou bought some vineyards in Burgundy and retired. His new life was calm until the day his farm tractor broke down.

The tractor's engine runs on a mechanism of gears and can be modeled as a two-dimensional grid. At most one gear sits at each position of the grid. All gears are identical and mesh with their neighbors. Because the grid is a hexagonal (parallelogram) layout, a gear at row $r$, column $c$ can mesh with up to six neighbors:

  • same row: $(r, c-1)$ and $(r, c+1)$
  • row above: $(r-1, c)$ and $(r-1, c+1)$
  • row below: $(r+1, c-1)$ and $(r+1, c)$

A neighbor exists only if that position also holds a gear.

When the tractor starts, some gears are initially activated and try to turn clockwise. Whenever a gear tries to turn in one direction, every gear meshed with it tries to turn in the opposite direction, and this propagates through the entire meshed group.

The engine was sabotaged: some gears were removed and others added, so some gears cannot move. An immobile gear is either free or blocked:

  • free — it is not initially activated and none of its neighbors is trying to turn;
  • blocked — it is forced to turn clockwise and counter-clockwise at the same time.

For example, consider three gears that all mesh with one another (a triangle). If any one of them is initially activated, all three become blocked. If none is activated, all three are free.

Given the engine layout and which gears are initially activated (clockwise), determine the state of every gear the moment the tractor starts: turning clockwise, turning counter-clockwise, free, or blocked.

Input

The input contains several test cases. The first line of each test case has two integers $R$ and $C$ separated by a single space ($1 \le R, C \le 100$): the number of rows and columns of the engine grid. Each of the next $R$ lines describes one row and contains $C$ characters:

  • . — no gear at this position;
  • * — a gear that is not initially activated;
  • I — a gear that is initially activated (it tries to turn clockwise).

For simplicity, the parallelogram-shaped grid is given as a rectangle with every row left-aligned. The input ends with a line containing $R = C = 0$, which must not be processed.

Output

For each test case, print $R$ lines describing the state of every position after the engine starts. Use exactly one character per position:

  • . — no gear;
  • ( — a gear turning clockwise;
  • ) — a gear turning counter-clockwise;
  • F — a free gear;
  • B — a blocked gear.

Separate the outputs of consecutive test cases with a single blank line (that is, print a blank line before every test case except the first).