|Contests||Virtual Contests||Problems||Submit||Runs Status||Rank List||Forum|
Your job is to determine the territory occupied by each life form after n days. The first line of input contains t, the number of test cases. Each test case begins with three integers not greater than 100: r and c, the number of rows and columns in the grid, and n. The grid is represented by the r lines that follow, each with c characters. Each character in the grid is R, S, or P, indicating that it is occupied by Rocks, Scissors, or Papers respectively.
For each test case, print the grid as it appears at the end of the nth day. Leave an empty line between the output for successive test cases.
2 3 3 1 RRR RSR RRR 3 4 2 RSPR SPRS PRSP
RRR RRR RRR RRRS RRSP RSPR