Write a program that reads a sequence of forests and prints the results of spreading all the fires of each forest.
Input consists of a sequence of forest descriptions. Each description consists of a line with and (a pair of natural numbers strictly positive that indicate respectively the number of rows and the number of columns of the forest), followed by lines, each one with characters: |’A’| for a tree without fire, |’F’| for a tree with fire, and |’.’| for an empty position.
For each forest of the input, print the result of spread all the fires, supposing that these are transmitted to the right, to the left, upwards and downwards, and that the final result of each fire is an empty position. Print an empty line after each forest.
Input
3 5 AAF.A .AA.. ..A.F 6 8 A.AAA.A. .A...A.. A.AAA.AF A.AFA.AF A.AAA.AF .A...AF. 6 11 AAA.AAAAAAA A.AAA...... A.....AAA.F A.AAA.A.A.A A.A.A.A.A.A AAA.AAA.AAA
Output
....A ..... ..... A.AAA.A. .A...A.. A....... A....... A....... .A...... ........... ........... ........... ........... ........... ...........