Prettify Text Blocks#3829

Prettify Text Blocks

1 second
64 megabytes
Very easy

You are given a rectangular text block, consisting of periods "." and asterisks "*". Two horizontally or vertically adjacent asterisks are connected. Your task is to convert each asterisk to a different character, depending on how it connects to other asterisks. An asterisk is converted to:

Input

The first input line contains the number of test cases , 1 \leq N \leq 50.

Each test case begins with a line containing integers and , separated by space. lines follow. Each line , 1 \leq i \leq h, consists of a string . The input text block is represented by vertically stacking s_1, s_2, ..., s_h.

  • is the height of the text block, and satisfies 1 \leq h \leq 50.

  • is the width of the text block, and satisfies 1 \leq w \leq 50.

  • For each , 1 \leq i \leq h, s_i is a length- string of periods "." or asterisks "*".

Output

For each test case, print lines of length- strings, represents the converted text block. Print a blank line between test cases, but not after the last test case.

Examples

Example 1

Loading
Loading