/**
 * Date: 19 Nov, 2019
 * Link: https://codeforces.com/contest/1255/problem/D
 *
 * @author Prasad Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class D_1255 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int m = in.ni();
            int k = in.ni();
            char c[][] = new char[n][m];
            for (int i = 0; i < n; i++) {
                c[i] = in.next().toCharArray();
            }
            int count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    count += c[i][j] - 'R' == 0 ? 1 : 0;
                }
            }
            int p = count / k;
            int mod = count % k;
            char a[] = new char[62];
            for (int i = 0; i < 26; i++) {
                a[i] = (char) (i + 'a');
            }
            for (int i = 26; i < 52; i++) {
                a[i] = (char) (i - 26 + 'A');
            }
            for (int i = 52; i < 62; i++) {
                a[i] = (char) (i - 52 + '0');
            }
            int index = 0;
            char ans[][] = new char[n][m];
            count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
                i++;
                if (i >= n) {
                    break;
                }
                for (int j = m - 1; j >= 0; j--) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
            }
            if(index==k){
                for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(ans[i][j] == a[index]) ans[i][j] = a[index-1];
            }
            for (int i = 0; i < n; i++) {
                in.println(new String(ans[i]));
            }
        }
        in.bw.flush();
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][][] gwtree(int n) throws IOException {
            int m = n - 1;
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = i + 1;
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][][] gwg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][] gtree(int n) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[n - 1];
            int to[] = new int[n - 1];
            int count[] = new int[n + 1];
            for (int i = 0; i < n - 1; i++) {
                from[i] = i + 1;
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < n - 1; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


/**
 * Date: 19 Nov, 2019
 * Link: https://codeforces.com/contest/1255/problem/D
 *
 * @author Prasad Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class D_1255 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int m = in.ni();
            int k = in.ni();
            char c[][] = new char[n][m];
            for (int i = 0; i < n; i++) {
                c[i] = in.next().toCharArray();
            }
            int count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    count += c[i][j] - 'R' == 0 ? 1 : 0;
                }
            }
            int p = count / k;
            int mod = count % k;
            char a[] = new char[62];
            for (int i = 0; i < 26; i++) {
                a[i] = (char) (i + 'a');
            }
            for (int i = 26; i < 52; i++) {
                a[i] = (char) (i - 26 + 'A');
            }
            for (int i = 52; i < 62; i++) {
                a[i] = (char) (i - 52 + '0');
            }
            int index = 0;
            char ans[][] = new char[n][m];
            count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = (i & 1) == 0 ? 0 : m - 1; (i & 1) == 0 ? j < m : j >= 0; j = ((i & 1) == 0) ? ++j : --j) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
            }
            // for (int i = 0; i < n; i++) {
            //     for (int j = 0; j < m; j++) {
            //         if (c[i][j] == 'R') {
            //             count++;
            //         }
            //         ans[i][j] = a[index];
            //         if (mod > 0) {
            //             if (count == p + 1) {
            //                 count = 0;
            //                 mod--;
            //                 index++;
            //             }
            //         } else {
            //             if (count == p) {
            //                 count = 0;
            //                 index++;
            //             }
            //         }
            //     }
            //     i++;
            //     if (i >= n) {
            //         break;
            //     }
            //     for (int j = m - 1; j >= 0; j--) {
            //         if (c[i][j] == 'R') {
            //             count++;
            //         }
            //         ans[i][j] = a[index];
            //         if (mod > 0) {
            //             if (count == p + 1) {
            //                 count = 0;
            //                 mod--;
            //                 index++;
            //             }
            //         } else {
            //             if (count == p) {
            //                 count = 0;
            //                 index++;
            //             }
            //         }
            //     }
            // }
            if (index == k && index < 62) {
                for (int i = 0; i < n; i++)
                    for (int j = 0; j < m; j++)
                        if (ans[i][j] == a[index])
                            ans[i][j] = a[index - 1];
            }
            for (int i = 0; i < n; i++) {
                in.println(new String(ans[i]));
            }
        }
        in.bw.flush();
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][][] gwtree(int n) throws IOException {
            int m = n - 1;
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = i + 1;
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][][] gwg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][] gtree(int n) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[n - 1];
            int to[] = new int[n - 1];
            int count[] = new int[n + 1];
            for (int i = 0; i < n - 1; i++) {
                from[i] = i + 1;
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < n - 1; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


/**
 * Date: 19 Nov, 2019
 * Link: https://codeforces.com/contest/1255/problem/D
 *
 * @author Prasad Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class D_1255 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int m = in.ni();
            int k = in.ni();
            char c[][] = new char[n][m];
            for (int i = 0; i < n; i++) {
                c[i] = in.next().toCharArray();
            }
            int count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    count += c[i][j] - 'R' == 0 ? 1 : 0;
                }
            }
            int p = count / k;
            int mod = count % k;
            char a[] = new char[62];
            for (int i = 0; i < 62; i++) {
                a[i] = i < 26 ? (char) (i + 'a') : (i < 52) ? (char) (i - 26 + 'A') : (char) (i - 52 + '0');
            }
            int index = 0;
            char ans[][] = new char[n][m];
            count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = (i & 1) == 0 ? 0 : m - 1; (i & 1) == 0 ? j < m : j >= 0; j = ((i & 1) == 0) ? ++j : --j) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
            }
            if (index == k && index < 62) {
                for (int i = 0; i < n; i++)
                    for (int j = 0; j < m; j++)
                        if (ans[i][j] == a[index])
                            ans[i][j] = a[index - 1];
            }
            for (int i = 0; i < n; i++) {
                in.println(new String(ans[i]));
            }
        }
        in.bw.flush();
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][][] gwtree(int n) throws IOException {
            int m = n - 1;
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = i + 1;
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][][] gwg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][] gtree(int n) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[n - 1];
            int to[] = new int[n - 1];
            int count[] = new int[n + 1];
            for (int i = 0; i < n - 1; i++) {
                from[i] = i + 1;
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < n - 1; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


/**
 * Date: 19 Nov, 2019
 * Link: https://codeforces.com/contest/1255/problem/D
 *
 * @author Prasad Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class D_1255 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int m = in.ni();
            int k = in.ni();
            char c[][] = new char[n][m];
            for (int i = 0; i < n; i++) {
                c[i] = in.next().toCharArray();
            }
            int count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    count += c[i][j] - 'R' == 0 ? 1 : 0;
                }
            }
            int p = count / k;
            int mod = count % k;
            char a[] = new char[62];
            for (int i = 0; i < 26; i++) {
                a[i] = (char) (i + 'a');
            }
            for (int i = 26; i < 52; i++) {
                a[i] = (char) (i - 26 + 'A');
            }
            for (int i = 52; i < 62; i++) {
                a[i] = (char) (i - 52 + '0');
            }
            int index = 0;
            char ans[][] = new char[n][m];
            count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
                i++;
                if (i >= n) {
                    break;
                }
                for (int j = m - 1; j >= 0; j--) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
            }
            if(index==k){
                for(int i=0;i<n;i++) for(int j=0;j<m;j++) if(a[i][j] == a[index]) a[i][j] = a[index-1];
            }
            for (int i = 0; i < n; i++) {
                in.println(new String(ans[i]));
            }
        }
        in.bw.flush();
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][][] gwtree(int n) throws IOException {
            int m = n - 1;
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = i + 1;
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][][] gwg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][] gtree(int n) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[n - 1];
            int to[] = new int[n - 1];
            int count[] = new int[n + 1];
            for (int i = 0; i < n - 1; i++) {
                from[i] = i + 1;
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < n - 1; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


/**
 * Date: 19 Nov, 2019
 * Link: https://codeforces.com/contest/1255/problem/D
 *
 * @author Prasad Chaudhari
 * @linkedIn: https://www.linkedin.com/in/prasad-chaudhari-841655a6/
 * @git: https://github.com/Prasad-Chaudhari
 */
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;

public class D_1255 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO in = new FastIO();
        int t = in.ni();
        while (t-- > 0) {
            int n = in.ni();
            int m = in.ni();
            int k = in.ni();
            char c[][] = new char[n][m];
            for (int i = 0; i < n; i++) {
                c[i] = in.next().toCharArray();
            }
            int count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    count += c[i][j] - 'R' == 0 ? 1 : 0;
                }
            }
            int p = count / k;
            int mod = count % k;
            char a[] = new char[62];
            for (int i = 0; i < 26; i++) {
                a[i] = (char) (i + 'a');
            }
            for (int i = 26; i < 52; i++) {
                a[i] = (char) (i - 26 + 'A');
            }
            for (int i = 52; i < 62; i++) {
                a[i] = (char) (i - 52 + '0');
            }
            int index = 0;
            char ans[][] = new char[n][m];
            count = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
                i++;
                if (i >= n) {
                    break;
                }
                for (int j = m - 1; j >= 0; j--) {
                    if (c[i][j] == 'R') {
                        count++;
                    }
                    ans[i][j] = a[index];
                    if (mod > 0) {
                        if (count == p + 1) {
                            count = 0;
                            mod--;
                            index++;
                        }
                    } else {
                        if (count == p) {
                            count = 0;
                            index++;
                        }
                    }
                }
            }
            for (int i = 0; i < n; i++) {
                in.println(new String(ans[i]));
            }
        }
        in.bw.flush();
    }

    static class Data implements Comparable<Data> {

        int a, b;

        public Data(int a, int b) {
            this.a = a;
            this.b = b;
        }

        @Override
        public int compareTo(Data o) {
            if (a == o.a) {
                return Integer.compare(b, o.b);
            }
            return Integer.compare(a, o.a);
        }

        public static void sort(int a[]) {
            Data d[] = new Data[a.length];
            for (int i = 0; i < a.length; i++) {
                d[i] = new Data(a[i], 0);
            }
            Arrays.sort(d);
            for (int i = 0; i < a.length; i++) {
                a[i] = d[i].a;
            }
        }
    }

    static class FastIO {

        private final BufferedReader br;
        private final BufferedWriter bw;
        private String s[];
        private int index;

        public FastIO() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            bw = new BufferedWriter(new OutputStreamWriter(System.out, "UTF-8"));
            s = br.readLine().split(" ");
            index = 0;
        }

        public int ni() throws IOException {
            return Integer.parseInt(nextToken());
        }

        public double nd() throws IOException {
            return Double.parseDouble(nextToken());
        }

        public long nl() throws IOException {
            return Long.parseLong(nextToken());
        }

        public String next() throws IOException {
            return nextToken();
        }

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = nl();
            }
            return a;
        }

        public int[][][] gwtree(int n) throws IOException {
            int m = n - 1;
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = i + 1;
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][][] gwg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int weight[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            int cost[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                cost[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
                weight[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][count[from[i]] - 1] = to[i];
                adja[to[i]][count[to[i]] - 1] = from[i];
                weight[from[i]][count[from[i]] - 1] = cost[i];
                weight[to[i]][count[to[i]] - 1] = cost[i];
                count[from[i]]--;
                count[to[i]]--;
            }
            return new int[][][] { adja, weight };
        }

        public int[][] gtree(int n) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[n - 1];
            int to[] = new int[n - 1];
            int count[] = new int[n + 1];
            for (int i = 0; i < n - 1; i++) {
                from[i] = i + 1;
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < n - 1; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public int[][] gg(int n, int m) throws IOException {
            int adja[][] = new int[n + 1][];
            int from[] = new int[m];
            int to[] = new int[m];
            int count[] = new int[n + 1];
            for (int i = 0; i < m; i++) {
                from[i] = ni();
                to[i] = ni();
                count[from[i]]++;
                count[to[i]]++;
            }
            for (int i = 0; i <= n; i++) {
                adja[i] = new int[count[i]];
            }
            for (int i = 0; i < m; i++) {
                adja[from[i]][--count[from[i]]] = to[i];
                adja[to[i]][--count[to[i]]] = from[i];
            }
            return adja;
        }

        public void print(String s) throws IOException {
            bw.write(s);
        }

        public void println(String s) throws IOException {
            bw.write(s);
            bw.newLine();
        }

        public void print(int s) throws IOException {
            bw.write(s + "");
        }

        public void println(int s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(long s) throws IOException {
            bw.write(s + "");
        }

        public void println(long s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        public void print(double s) throws IOException {
            bw.write(s + "");
        }

        public void println(double s) throws IOException {
            bw.write(s + "");
            bw.newLine();
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastReader read = new FastReader();
        StringBuilder out = new StringBuilder();
        int t = read.nextInt();
        ArrayList<Character> sym = new ArrayList<>();
        for (int i = 0; i < 26; i++) {
            sym.add((char) ('a' + i));
            sym.add((char) ('A' + i));
        }
        for (int i = '0'; i <= '9'; i++) {
            sym.add((char) i);
        }
        while (t-- > 0) {
            int r = read.nextInt();
            int c = read.nextInt();
            int k = read.nextInt();

            char[][] grid = new char[r][c];
            for (int i = 0; i < r; i++) {
                grid[i] = read.nextLine().toCharArray();
            }
            int ros = getRos(grid);
            int f = ros / k;
            int rem = ros % k;
            int checkenRos[] = new int[k];
            for (int i = 0; i < k; i++) {
                checkenRos[i] = f;
                checkenRos[i] += rem > 0 ? 1 : 0;
                rem--;
            }
            int row = 0;
            int col = 0;
            boolean left = true;
            char sem = 's';
            for (int i = 0; i < k; i++) {
                sem = sym.get(i);
                while (checkenRos[i] > 0) {
                    if (grid[row][col] == 'R') {
                        checkenRos[i]--;
                    }
                    grid[row][col] = sym.get(i);
                    col += left ? 1 : -1;
                    if (col == c || col < 0) {
                        col = left ? c - 1 : 0;
                        left = !left;
                        row++;
                    }
                }
            }

            for (int i = 0; i < grid.length; i++) {
                for (int j = 0; j < grid[i].length; j++) {
                    out.append(grid[i][j] == '.' ? sem : grid[i][j]);
                }
                out.append('\n');
            }
        }
        System.out.print(out);

    }

    public static int getRos(char[][] grid) {
        int ros = 0;
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[i].length; j++) {
                ros += grid[i][j] == 'R' ? 1 : 0;
            }
        }
        return ros;
    }

}

class Pair implements Comparable<Pair> {
    int id;
    int w;

    public Pair(int id, int w) {
        this.id = id;
        this.w = w;
    }

    @Override
    public int compareTo(Pair p) {
        if (this.w != p.w) {
            return this.w - p.w;
        }
        return this.id - p.id;
    }
}

class FastReader {

    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DFeedingChicken solver = new DFeedingChicken();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFeedingChicken {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {

            int t = in.scanInt();

            while (t-- > 0) {

                int n = in.scanInt();
                int m = in.scanInt();
                int k = in.scanInt();

                int sum = 0;

                char arr[][] = new char[n][m];
                for (int i = 0; i < n; i++) {
                    arr[i] = in.scanString().toCharArray();
                    for (int j = 0; j < m; j++) sum += (arr[i][j] == 'R') ? 1 : 0;
                }
                int result = sum / k;
                int rem = sum % k;

                ArrayList<Integer> arrayList = new ArrayList<>();

                for (int i = 'a'; i <= 'z'; i++) arrayList.add(i);
                for (int i = 'A'; i <= 'Z'; i++) arrayList.add(i);
                for (int i = '0'; i <= '9'; i++) arrayList.add(i);

                int ptr = 0, count = 0;
                char ans[][] = new char[n][m];

                for (int i = 0; i < n; i++) {
                    if (i % 2 == 0) {
                        for (int j = 0; j < m; j++) {
                            if (arr[i][j] == 'R') count++;
                            ans[i][j] = (char) arrayList.get(ptr).intValue();
                            if (count == result + ((rem > 0) ? 1 : 0)) {
                                ptr++;
                                if (ptr == k) ptr--;
                                count = 0;
                                rem--;
                            }
                        }
                    } else {
                        for (int j = m - 1; j >= 0; j--) {
                            if (arr[i][j] == 'R') count++;
                            ans[i][j] = (char) arrayList.get(ptr).intValue();
                            if (count == result + ((rem > 0) ? 1 : 0)) {
                                ptr++;
                                if (ptr == k) ptr--;
                                count = 0;
                                rem--;
                            }
                        }
                    }

                }

                for (int i = 0; i < n; i++) {
                    out.println(String.valueOf(ans[i]));
                }
            }

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        public String scanString() {
            int c = scan();
            while (isWhiteSpace(c)) c = scan();
            StringBuilder RESULT = new StringBuilder();
            do {
                RESULT.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return RESULT.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jenish
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DFeedingChicken solver = new DFeedingChicken();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFeedingChicken {
        public void solve(int testNumber, ScanReader in, PrintWriter out) {

            int t = in.scanInt();

            while (t-- > 0) {

                int n = in.scanInt();
                int m = in.scanInt();
                int k = in.scanInt();

                int sum = 0;

                char arr[][] = new char[n][m];
                for (int i = 0; i < n; i++) {
                    arr[i] = in.scanString().toCharArray();
                    for (int j = 0; j < m; j++) sum += (arr[i][j] == 'R') ? 1 : 0;
                }
                int result = sum / k;
                int rem = sum % k;

                ArrayList<Integer> arrayList = new ArrayList<>();

                for (int i = 'a'; i <= 'z'; i++) arrayList.add(i);
                for (int i = 'A'; i <= 'Z'; i++) arrayList.add(i);
                for (int i = '0'; i <= '9'; i++) arrayList.add(i);

                int ptr = 0, count = 0;
                char ans[][] = new char[n][m];

                for (int i = 0; i < n; i++) {
                    if (i % 2 == 0) {
                        for (int j = 0; j < m; j++) {
                            if (arr[i][j] == 'R') count++;
                            ans[i][j] = (char) arrayList.get(ptr).intValue();
                            if (count == result + ((rem > 0) ? 1 : 0)) {
                                ptr++;
                                count = 0;
                                rem--;
                            }
                        }
                    } else {
                        for (int j = m - 1; j >= 0; j--) {
                            if (arr[i][j] == 'R') count++;
                            ans[i][j] = (char) arrayList.get(ptr).intValue();
                            if (count == result + ((rem > 0) ? 1 : 0)) {
                                ptr++;
                                count = 0;
                                rem--;
                            }
                        }
                    }

                }

                for (int i = 0; i < n; i++) {
                    out.println(String.valueOf(ans[i]));
                }
            }

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int INDEX;
        private BufferedInputStream in;
        private int TOTAL;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (INDEX >= TOTAL) {
                INDEX = 0;
                try {
                    TOTAL = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (TOTAL <= 0) return -1;
            }
            return buf[INDEX++];
        }

        public int scanInt() {
            int I = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    I *= 10;
                    I += n - '0';
                    n = scan();
                }
            }
            return neg * I;
        }

        public String scanString() {
            int c = scan();
            while (isWhiteSpace(c)) c = scan();
            StringBuilder RESULT = new StringBuilder();
            do {
                RESULT.appendCodePoint(c);
                c = scan();
            } while (!isWhiteSpace(c));
            return RESULT.toString();
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}


import java.util.*;
import java.io.*;
public class Main {

    private static char[] chars = {
            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
            'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
            's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
    };

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        int T = in.nextInt();
        for (int i = 0; i < T; i++) {
            int r = in.nextInt(), c = in.nextInt(), chickens = in.nextInt();
            char[][] m = new char[r][c];
            int rice = 0;
            for (int j = 0; j < r; j++) {
                String s = in.next();
                for (int k = 0; k < c; k++) {
                    m[j][k] = s.charAt(k);
                    rice += s.charAt(k) == 'R' ? 1 : 0;
                }
            }
            int min = rice / chickens, rem = rice % chickens;
            char[][] res = new char[r][c];
            int x = 0, y = 0;
            boolean right = true;
            int count = 0, ind = 0;
            int exit = 0;
            while (exit < r * c) {
                res[x][y] = chars[ind];
                if (m[x][y] == 'R') count++;
                if (count == min + 1 && rem > 0 && ind < chickens - 1) {
                    count = 0;
                    rem--;
                    ind++;
                } else if (count == min && rem <= 0 && ind < chickens - 1) {
                    count = 0;
                    ind++;
                }
                exit++;
                if (right) {
                    if (y < c - 1) {
                        y++;
                    } else {
                        right = false;
                        x++;
                    }
                } else {
                    if (y > 0) {
                        y--;
                    } else {
                        right = true;
                        x++;
                    }
                }
            }
            for (int j = 0; j < r; j++) {
                for (int k = 0; k < c; k++) {
                    System.out.print(res[j][k]);
                }
                System.out.println();
            }
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Say My Name
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        DFeedingChicken solver = new DFeedingChicken();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFeedingChicken {
        public void solve(int testNumber, InputReader c, OutputWriter w) {
            int t = c.readInt();
            while (t-- > 0) {
                int n = c.readInt(), m = c.readInt(), k = c.readInt();
                int jk = 0;
                char[][] mat = new char[n][];
                for (int i = 0; i < n; i++) {
                    mat[i] = c.readString().toCharArray();
                }
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        if (mat[i][j] == 'R') {
                            jk++;
                        }
                    }
                }
                int lo = jk / k, ll = jk % k;
                int kl = 0;
                HashMap<Integer, Character> hm = new HashMap<>();
                for (int i = 0; i < 26; i++) {
                    hm.put(i, (char) ('a' + i));
                }
                for (int i = 26; i < 26 + 26; i++) {
                    hm.put(i, (char) ('A' + i - 26));
                }
                for (int i = 26 + 26; i < 26 + 26 + 10; i++) {
                    hm.put(i, (char) ('0' + i - 26 - 26));
                }
                int cur = 0;
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        if (mat[i][j] == 'R') {
                            if (kl == lo) {
                                if (ll > 0) {
                                    kl++;
                                    ll--;
                                    mat[i][j] = hm.get(cur);
                                } else {
                                    kl = 1;
                                    cur++;
                                    mat[i][j] = hm.get(cur);
                                }
                            } else if (kl < lo) {
                                kl++;
                                mat[i][j] = hm.get(cur);
                            } else {
                                kl = 1;
                                cur++;
                                mat[i][j] = hm.get(cur);
                            }
                        } else {
                            mat[i][j] = hm.get(cur);
                        }
                    }
                }
                for (int i = 0; i < n; i++) {
                    w.printLine(mat[i]);
                }
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(char[] array) {
            writer.println(array);
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Say My Name
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        DFeedingChicken solver = new DFeedingChicken();
        solver.solve(1, in, out);
        out.close();
    }

    static class DFeedingChicken {
        public void solve(int testNumber, InputReader c, OutputWriter w) {
            int t = c.readInt();
            while (t-- > 0) {
                int n = c.readInt(), m = c.readInt(), k = c.readInt();
                int jk = 0;
                char[][] mat = new char[n][];
                for (int i = 0; i < n; i++) {
                    mat[i] = c.readString().toCharArray();
                }
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < m; j++) {
                        if (mat[i][j] == 'R') {
                            jk++;
                        }
                    }
                }
                int lo = jk / k, ll = jk % k;
                int kl = 0;
                HashMap<Integer, Character> hm = new HashMap<>();
                for (int i = 0; i < 26; i++) {
                    hm.put(i, (char) ('a' + i));
                }
                for (int i = 26; i < 26 + 26; i++) {
                    hm.put(i, (char) ('A' + i - 26));
                }
                for (int i = 26 + 26; i < 26 + 26 + 10; i++) {
                    hm.put(i, (char) ('0' + i - 26 - 26));
                }
                int cur = 0;
                for (int i = 0; i < n; i++) {
                    if (i % 2 == 0) {
                        for (int j = 0; j < m; j++) {
                            if (mat[i][j] == 'R') {
                                if (kl == lo) {
                                    if (ll > 0) {
                                        kl++;
                                        ll--;
                                        mat[i][j] = hm.get(cur);
                                    } else {
                                        kl = 1;
                                        cur++;
                                        mat[i][j] = hm.get(cur);
                                    }
                                } else if (kl < lo) {
                                    kl++;
                                    mat[i][j] = hm.get(cur);
                                } else {
                                    kl = 1;
                                    cur++;
                                    mat[i][j] = hm.get(cur);
                                }
                            } else {
                                mat[i][j] = hm.get(cur);
                            }
                        }
                    } else {
                        for (int j = m - 1; j >= 0; j--) {
                            if (mat[i][j] == 'R') {
                                if (kl == lo) {
                                    if (ll > 0) {
                                        kl++;
                                        ll--;
                                        mat[i][j] = hm.get(cur);
                                    } else {
                                        kl = 1;
                                        cur++;
                                        mat[i][j] = hm.get(cur);
                                    }
                                } else if (kl < lo) {
                                    kl++;
                                    mat[i][j] = hm.get(cur);
                                } else {
                                    kl = 1;
                                    cur++;
                                    mat[i][j] = hm.get(cur);
                                }
                            } else {
                                mat[i][j] = hm.get(cur);
                            }
                        }
                    }
                }
                for (int i = 0; i < n; i++) {
                    w.printLine(mat[i]);
                }
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void printLine(char[] array) {
            writer.println(array);
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.util.*;
import java.io.*;

/*
1
5 5 4
RRR..
R.R..
RRR..
R..R.
RR...
 */

public class R601D {

	public static void main(String[] args) {
		JS scan = new JS();
		char[] map = new char[62];
		for(int i = 0; i < 10; i++) {
			map[i] = (char)(i+'0');
		}
		for(int i = 10; i < 36; i++) {
			map[i] = (char)(i-10+'A');
		}
		for(int i = 36; i < 62; i++) {
			map[i] = (char)(i-36+'a');
		}
		PrintWriter out = new PrintWriter(System.out);
//		System.out.println(Arrays.toString(map));
		int t = scan.nextInt();
		for(int q = 1; q <= t; q++) {
			int r = scan.nextInt();
			int c = scan.nextInt();
			int k = scan.nextInt();
			char[][] grid = new char[r][c];
			int rice = 0;
			for(int i = 0; i < r; i++) {
				grid[i] = scan.next().toCharArray();
				for(int j = 0; j < c; j++) {
					if(grid[i][j] == 'R') rice++;
				}
			}
			int mod = rice%k; //amt of people who get +1
			int need = rice/k;
			char[][] ans = new char[r][c];
			for(int i = 0; i < r; i++) Arrays.fill(ans[i], '?');
			int count = 0;
			int me = 0;
			for(int i = 0; i < r; i++) {
				if(i % 2 == 0) {
					for(int j = 0; j < c; j++) {
						if(me == k) break;
						ans[i][j] = map[me];
						if(grid[i][j] == 'R') count++;
						int an = need;
						if(me < mod) {
							an++;
						}
						if(count == an) {
							count = 0;
							me++;
						}
					}
				}
				else {
					for(int j = c-1; j >= 0; j--) {
						if(me == k) break;
						ans[i][j] = map[me];
						if(grid[i][j] == 'R')  count++;
						int an = need;
						if(me < mod) {
							an++;
						}
						if(count == an) {
							count = 0;
							me++;
						}
					}
				}
			}
			for(int i = 0; i < r; i++) {
				for(int j = 0; j < c; j++) {
					if(ans[i][j] == '?') ans[i][j] = map[me-1];
				}
			}
			for(int i = 0; i < r; i++) {
				for(int j = 0; j < c; j++) {
					out.print(ans[i][j]);
				}
				out.println();
			}
		}
		out.flush();
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
}


import java.util.*;
import java.io.*;

public class R601D {

	public static void main(String[] args) {
		JS scan = new JS();
		char[] map = new char[62];
		for(int i = 0; i < 10; i++) {
			map[i] = (char)(i+'0');
		}
		for(int i = 10; i < 36; i++) {
			map[i] = (char)(i-10+'A');
		}
		for(int i = 36; i < 62; i++) {
			map[i] = (char)(i-36+'a');
		}
		PrintWriter out = new PrintWriter(System.out);
//		System.out.println(Arrays.toString(map));
		int t = scan.nextInt();
		for(int q = 1; q <= t; q++) {
			int r = scan.nextInt();
			int c = scan.nextInt();
			int k = scan.nextInt();
			char[][] grid = new char[r][c];
			int rice = 0;
			for(int i = 0; i < r; i++) {
				grid[i] = scan.next().toCharArray();
				for(int j = 0; j < c; j++) {
					if(grid[i][j] == 'R') rice++;
				}
			}
			int mod = rice%k; //amt of people who get +1
			int need = rice/k;
			char[][] ans = new char[r][c];
			for(int i = 0; i < r; i++) Arrays.fill(ans[i], '?');
			int count = 0;
			int me = 0;
			for(int i = 0; i < r; i++) {
				if(i % 2 == 0) {
					for(int j = 0; j < c; j++) {
						ans[i][j] = map[me];
						if(grid[i][j] == 'R') count++;
						int an = need;
						if(me < mod) {
							an++;
						}
						if(count == an) {
							count = 0;
							me++;
						}
					}
				}
				else {
					for(int j = c-1; j >= 0; j--) {
						ans[i][j] = map[me];
						if(grid[i][j] == 'R')  count++;
						int an = need;
						if(me < mod) {
							an++;
						}
						if(count == an) {
							count = 0;
							me++;
						}
					}
				}
			}
			for(int i = 0; i < r; i++) {
				for(int j = 0; j < c; j++) {
					if(ans[i][j] == '?') ans[i][j] = map[me-1];
				}
			}
			for(int i = 0; i < r; i++) {
				for(int j = 0; j < c; j++) {
					out.print(ans[i][j]);
				}
				out.println();
			}
		}
		out.flush();
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
}