There is a square field of size n × n in which two cells are marked. These cells can be in the same row or column.

You are to mark two more cells so that they are the corners of a rectangle with sides parallel to the coordinate axes.

For example, if n=4 and a rectangular field looks like this (there are asterisks in the marked cells):

$$$ \begin{matrix} . & . & * & . \\\ . & . & . & . \\\ * & . & . & . \\\ . & . & . & . \\\ \end{matrix} $$$

Then you can mark two more cells as follows

$$$ \begin{matrix} * & . & * & . \\\ . & . & . & . \\\ * & . & * & . \\\ . & . & . & . \\\ \end{matrix} $$$

If there are several possible solutions, then print any of them.

Input

The first line contains a single integer t (1 ≤ t ≤ 400). Then t test cases follow.

The first row of each test case contains a single integer n (2 ≤ n ≤ 400) — the number of rows and columns in the table.

The following n lines each contain n characters '.' or '*' denoting empty and marked cells, respectively.

It is guaranteed that the sums of n for all test cases do not exceed 400.

It is guaranteed that there are exactly two asterisks on the field. They can be in the same row/column.

It is guaranteed that the solution exists.

Output

For each test case, output n rows of n characters — a field with four asterisks marked corresponding to the statements. If there multiple correct answers, print any of them.

Example

Input


6
4
..*.
....
*...
....
2
*.
.*
2
.*
.*
3
*.*
...
...
5
.....
..*..
.....
.*...
.....
4
....
....
*...
*...


Output


*.*.
....
*.*.
....
**
**
**
**
*.*
*.*
...
.....
.**..
.....
.**..
.....
....
....
**..
**..
import java.util.Comparator;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.*;

public class Main {
    static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) throws Exception {

        int T = sc.nextInt();
        for(int t = 1; t <= T; ++t){
            solve1();
        }
        /*
        int[] bucket = new int[]{1, 3};
        int[] vat = new int[]{6, 8};
        int ans = storeWater(bucket, vat);
        System.out.println(ans);
        */
    }
    public static void solve1() throws Exception{
        int n = sc.nextInt();
        char[][] grid = new char[n][n];
        int first_x = -1;
        int first_y = -1;
        int sec_x = -1;
        int sec_y = -1;
        for (int i = 0; i < n; i++) {
            String row = sc.next();
            for (int j = 0; j < n; j++) {
                if(row.charAt(j) == '*'){
                    sec_x = first_x;
                    sec_y = first_y;
                    first_x = i;
                    first_y = j;
                    grid[i][j] = '*';
                }
                else
                    grid[i][j] = '.';
            }
        }
        if(first_x != sec_x && first_y != sec_y){
            grid[first_x][sec_y] = '*';
            grid[sec_x][first_y] = '*';
        }
        else{
            if(first_x == sec_x){
                if(first_x == 0){
                    grid[1][first_y] = '*';
                    grid[1][sec_y] = '*';
                }
                else if(first_x == n-1){
                    grid[n-2][first_y] = '*';
                    grid[n-2][sec_y] = '*';
                }
                else{
                    grid[first_x-1][first_y] = '*';
                    grid[sec_x-1][sec_y] = '*';
                }
            }
            else{
                if(first_y == 0){
                    grid[first_x][1] = '*';
                    grid[sec_x][1] = '*';
                }
                else if(first_y == n-1){
                    grid[first_x][n-2] = '*';
                    grid[sec_x][n-2] = '*';
                }
                else{
                    grid[first_x][first_y-1] = '*';
                    grid[sec_x][sec_y-1] = '*';
                }
            }
        }
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                System.out.print(grid[i][j]);
            }
            System.out.println();
        }
    }


    public static int storeWater(int[] bucket, int[] vat) {
        TreeSet<Pairs> times = new TreeSet<>(new KComparator());
        int len = vat.length;
        int ans = 0;
        for (int i = 0; i < len; i++) {
            if(vat[i] != 0 && bucket[i] == 0){
                bucket[i] = 1;
                ans++;
            }
        }
        for (int i = 0; i < len; i++) {
            if(vat[i] != 0){
                times.add(new Pairs((double)vat[i] /(double) bucket[i], i));
            }
        }


        while (true){
            Pairs cur = times.pollLast();
            int i = cur.getValue();
            double k = cur.getKey();
            if(k - (double)vat[i] / (double)(bucket[i] + 1) > 1){
                bucket[i]++;
                ans++;
                times.add(new Pairs((double)vat[i] /(double) bucket[i], i));
                //System.out.println("to " + vat[i] + "  " + bucket[i]);
            }
            else{
                break;
            }
        }
        Pairs cur = times.pollLast();
        int tem = cur.getValue();
        if(vat[tem] % bucket[tem] == 0)
            ans += vat[tem] / bucket[tem];
        else
            ans += (vat[tem] / bucket[tem]) + 1;
        return ans;
    }
    static class KComparator implements Comparator<Pairs>{
        @Override
        public int compare(Pairs o1, Pairs o2) {
            double val1 = o1.key;
            double val2 = o1.key;
            if(val1 > val2)
                return 1;
            else if(val1 < val2)
                return -1;
            else
                return 1;
        }
    }
    static class Pairs implements  Comparable<Pairs>  {
        private double key;
        public double getKey() { return key; }
        private int value;
        public int getValue() { return value; }
        public Pairs(double key, int value) {
            this.key = key;
            this.value = value;
        }
        @Override
        public String toString() {
            return "Key = " + key + ", Value = " + value;
        }
        @Override
        public int compareTo(Pairs o) {
            return java.lang.Double.compare(o.getKey(), this.key);
        }
    }
    public static void solve(int t) throws Exception {
        int n = sc.nextInt();
        if(n == 0)  return;
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        int ans = 0;
        int lastNum = arr[0];
        int lastFront = arr[0];
        int lastDig = 1;
        while(lastFront >= 10){
            lastFront /= 10;
            lastDig++;
        }
        /*
        System.out.print("Num[0] = " + lastNum);
        System.out.print("  NumDig[0] = " + lastDig);
        System.out.println("  NumFront[0] = " + lastFront);

         */

        for (int i = 1; i < n; ++i){
            int curNum = arr[i];
            boolean goUp = false;
            int curFront = curNum;
            int curDig = 1;
            while(curFront >= 10){
                curFront /= 10;
                curDig++;
            }
            /*
            System.out.print("Num["+i+"] = " + curNum);
            System.out.print("  NumDig["+i+"] = " + curDig);
            System.out.println("  NumFront["+i+"] = " + curFront);

             */
            if(curNum > lastNum){
                lastNum = curNum;
                lastDig = curDig;
                lastFront = curFront;
                continue;
            }
            if(curFront < lastFront || curNum == lastNum)
                goUp = true;
            else if(curFront == lastFront){
                int CUR = curNum;
                int cur_p = curDig-1;
                int LAST = lastNum;
                int last_p = lastDig-1;
                int DIG = 1;
                while(CUR > 0 && LAST > 0){
                    int a = (int) ( CUR / Math.pow(10, cur_p));
                    int b = (int) ( LAST / Math.pow(10, last_p));
                    /*
                    System.out.println("a = " + a);
                    System.out.println("b = " + b);

                     */
                    if(a < b){
                        goUp = true;
                        break;
                    }
                    CUR =  CUR % ((int)Math.pow(10, cur_p+1));
                    LAST = LAST % ((int) Math.pow(10, last_p+1));
                    cur_p--;
                    last_p--;
                    /*
                    System.out.println("CUR = " + CUR);
                    System.out.println("LAST = " + LAST);

                     */
                }

            }
            if(goUp){
                ans += lastDig-curDig+1;
                //System.out.println("ans += " + (lastDig-curDig+1));
                arr[i] *= Math.pow(10, lastDig-curDig+1);
                lastDig += lastDig-curDig;
                lastNum = arr[i];
                lastFront = curFront;
                /*
                System.out.println("UP: Changed to:");
                System.out.print("arr["+i+"] = " + arr[i]);
                System.out.print("  NumDig["+i+"] = " + lastDig);
                System.out.println("  NumFront["+i+"] = " + lastFront);

                 */
            }
            else{
                curNum *= Math.pow(10, lastDig-curDig);
                ans += lastDig - curDig;
                //System.out.println("ans += " + (lastDig - curDig));
                int reminder = (int) (lastNum % Math.pow(10,lastDig-curDig));
                curNum += reminder;
                if(curFront == lastFront)
                    curNum++;

                lastNum = curNum;
                lastFront = curFront;
                /*
                System.out.println("Don't UP: Changed to:");
                System.out.print("Num["+i+"] = " + curNum);
                System.out.print("  NumDig["+i+"] = " + lastDig);
                System.out.println("  NumFront["+i+"] = " + curFront);

                 */
            }
        }
        System.out.println("Case #" + t + ": " + ans);
    }
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(
                    new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    if (cnt != 0) {
                        break;
                    }
                    else {
                        continue;
                    }
                }
                buf[cnt++] = (byte)c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0,
                    BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
}
