import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class D {
    static 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;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static void dfs(char[][] arr,int i,int j,boolean[][] vis,int n,int m)
    {
        vis[i][j]=true;
        if(i>0 && !vis[i-1][j] && (arr[i-1][j]=='.' ||  arr[i-1][j]=='G' ||  arr[i-1][j]=='B'))
        {
            dfs(arr,i-1,j,vis,n,m);
        }
        if(j>0 && !vis[i][j-1] && (arr[i][j-1]=='.' ||  arr[i][j-1]=='G'||  arr[i][j-1]=='B'))
        {
            dfs(arr,i,j-1,vis,n,m);
        }

        if(i<n-1 && !vis[i+1][j] && (arr[i+1][j]=='.' ||  arr[i+1][j]=='G'||  arr[i+1][j]=='B'))
        {
            dfs(arr,i+1,j,vis,n,m);
        }
        if(j<m-1 && !vis[i][j+1] && (arr[i][j+1]=='.' ||  arr[i][j+1]=='G'||  arr[i][j+1]=='B'))
        {
            dfs(arr,i,j+1,vis,n,m);
        }
    }
    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        int t = ri();
//        int t= 1;
        while (t-- > 0)
        {
            List<Character> list=new ArrayList<>();
            for(char c='a';c<='z';c++)
            {
                list.add(c);
            }
            for(char c='A';c<='Z';c++)
            {
                list.add(c);
            }
            for(char c='0';c<='9';c++)
            {
                list.add(c);
            }
            int n=ri();
            int m=ri();
            int k=ri();
            char[][] arr=new char[n][m];
            int count=0;
            for(int i=0;i<n;i++)
            {
                arr[i]= rs().toCharArray();
                for(int j=0;j<m;j++)
                {
                    if(arr[i][j]=='R')
                    {
                        count++;
                    }
                }
            }
            int min=count/k;
            int max=min;
            if(count%k!=0)
            {
                max++;
            }
            int cmax=count-(min*k);
            int cmin=k-cmax;
            char[][] res=new char[n][m];
            for(int i=0;i<n;i++)
            {
                Arrays.fill(res[i],'_');
            }
            int val=0;
            int c=0;
            for(int i=0;i<n;i++)
            {
                if((i&1)==0)
                {
                    for(int j=0;j<m;j++)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = list.get(val);
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmin--;
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=list.get(val);
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmax--;
                            }
                        }
                    }
                }
                else
                {
                    for(int j=m-1;j>=0;j--)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = list.get(val);
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmin--;
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=list.get(val);
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmax--;
                            }
                        }
                    }
                }
            }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    ans.append(res[i][j]).append(" ");
                }
                ans.append("\n");
            }

        }
        out.print(ans.toString());
        out.flush();

    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class D {
    static 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;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static void dfs(char[][] arr,int i,int j,boolean[][] vis,int n,int m)
    {
        vis[i][j]=true;
        if(i>0 && !vis[i-1][j] && (arr[i-1][j]=='.' ||  arr[i-1][j]=='G' ||  arr[i-1][j]=='B'))
        {
            dfs(arr,i-1,j,vis,n,m);
        }
        if(j>0 && !vis[i][j-1] && (arr[i][j-1]=='.' ||  arr[i][j-1]=='G'||  arr[i][j-1]=='B'))
        {
            dfs(arr,i,j-1,vis,n,m);
        }

        if(i<n-1 && !vis[i+1][j] && (arr[i+1][j]=='.' ||  arr[i+1][j]=='G'||  arr[i+1][j]=='B'))
        {
            dfs(arr,i+1,j,vis,n,m);
        }
        if(j<m-1 && !vis[i][j+1] && (arr[i][j+1]=='.' ||  arr[i][j+1]=='G'||  arr[i][j+1]=='B'))
        {
            dfs(arr,i,j+1,vis,n,m);
        }
    }
    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        int t = ri();
//        int t= 1;
        while (t-- > 0)
        {
            int n=ri();
            int m=ri();
            int k=ri();
            char[][] arr=new char[n][m];
            int count=0;
            for(int i=0;i<n;i++)
            {
                arr[i]= rs().toCharArray();
                for(int j=0;j<m;j++)
                {
                    if(arr[i][j]=='R')
                    {
                        count++;
                    }
                }
            }
            int min=count/k;
            int max=min;
            if(count%k!=0)
            {
                max++;
            }
            int cmax=count-(min*k);
            int cmin=k-cmax;
            int[][] res=new int[n][m];
            for(int i=0;i<n;i++)
            {
                Arrays.fill(res[i],-1);
            }
            int val=1;
            int c=0;
            for(int i=0;i<n;i++)
            {
                if((i&1)==0)
                {
                    for(int j=0;j<m;j++)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = val;
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=val++;
                                cmin--;
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=val;
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=val++;
                                cmax--;
                            }
                        }
                    }
                }
                else
                {
                    for(int j=m-1;j>=0;j--)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = val;
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=val++;
                                cmin--;
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=val;
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=val++;
                                cmax--;
                            }
                        }
                    }
                }
            }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    ans.append(res[i][j]).append(" ");
                }
                ans.append("\n");
            }

        }
        out.print(ans.toString());
        out.flush();

    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class D {
    static 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;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static void dfs(char[][] arr,int i,int j,boolean[][] vis,int n,int m)
    {
        vis[i][j]=true;
        if(i>0 && !vis[i-1][j] && (arr[i-1][j]=='.' ||  arr[i-1][j]=='G' ||  arr[i-1][j]=='B'))
        {
            dfs(arr,i-1,j,vis,n,m);
        }
        if(j>0 && !vis[i][j-1] && (arr[i][j-1]=='.' ||  arr[i][j-1]=='G'||  arr[i][j-1]=='B'))
        {
            dfs(arr,i,j-1,vis,n,m);
        }

        if(i<n-1 && !vis[i+1][j] && (arr[i+1][j]=='.' ||  arr[i+1][j]=='G'||  arr[i+1][j]=='B'))
        {
            dfs(arr,i+1,j,vis,n,m);
        }
        if(j<m-1 && !vis[i][j+1] && (arr[i][j+1]=='.' ||  arr[i][j+1]=='G'||  arr[i][j+1]=='B'))
        {
            dfs(arr,i,j+1,vis,n,m);
        }
    }
    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        int t = ri();
//        int t= 1;
        while (t-- > 0)
        {
            List<Character> list=new ArrayList<>();
            for(char c='a';c<='z';c++)
            {
                list.add(c);
            }
            for(char c='A';c<='Z';c++)
            {
                list.add(c);
            }
            for(char c='0';c<='9';c++)
            {
                list.add(c);
            }
            int n=ri();
            int m=ri();
            int k=ri();
            char[][] arr=new char[n][m];
            int count=0;
            for(int i=0;i<n;i++)
            {
                arr[i]= rs().toCharArray();
                for(int j=0;j<m;j++)
                {
                    if(arr[i][j]=='R')
                    {
                        count++;
                    }
                }
            }
            int min=count/k;
            int max=min;
            if(count%k!=0)
            {
                max++;
            }
            int cmax=count-(min*k);
            int cmin=k-cmax;
            char[][] res=new char[n][m];
            for(int i=0;i<n;i++)
            {
                Arrays.fill(res[i],'_');
            }
            int val=0;
            int c=0;
            for(int i=0;i<n;i++)
            {
                if((i&1)==0)
                {
                    for(int j=0;j<m;j++)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = list.get(val);
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=list.get(val);
                                cmin--;
                                if(val<k-1)
                                {
                                    val++;
                                }
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=list.get(val);
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=list.get(val);
                                cmax--;
                                if(val<k-1)
                                {
                                    val++;
                                }
                            }
                        }
                    }
                }
                else
                {
                    for(int j=m-1;j>=0;j--)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = list.get(val);
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=list.get(val);
                                cmin--;
                                if(val<k-1)
                                {
                                    val++;
                                }
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=list.get(val);
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=list.get(val);
                                cmax--;
                                if(val<k-1)
                                {
                                    val++;
                                }
                            }
                        }
                    }
                }
            }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    ans.append(res[i][j]);
                }
                ans.append("\n");
            }

        }
        out.print(ans.toString());
        out.flush();

    }
}


import java.io.*;
import java.lang.reflect.Array;
import java.util.*;

public class D {
    static 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;
        }
    }

    static FastReader s = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);

    private static int[] rai(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextInt();
        }
        return arr;
    }

    private static int[][] rai(int n, int m) {
        int[][] arr = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextInt();
            }
        }
        return arr;
    }

    private static long[] ral(int n) {
        long[] arr = new long[n];
        for (int i = 0; i < n; i++) {
            arr[i] = s.nextLong();
        }
        return arr;
    }

    private static long[][] ral(int n, int m) {
        long[][] arr = new long[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                arr[i][j] = s.nextLong();
            }
        }
        return arr;
    }

    private static int ri() {
        return s.nextInt();
    }

    private static long rl() {
        return s.nextLong();
    }

    private static String rs() {
        return s.next();
    }

    static void dfs(char[][] arr,int i,int j,boolean[][] vis,int n,int m)
    {
        vis[i][j]=true;
        if(i>0 && !vis[i-1][j] && (arr[i-1][j]=='.' ||  arr[i-1][j]=='G' ||  arr[i-1][j]=='B'))
        {
            dfs(arr,i-1,j,vis,n,m);
        }
        if(j>0 && !vis[i][j-1] && (arr[i][j-1]=='.' ||  arr[i][j-1]=='G'||  arr[i][j-1]=='B'))
        {
            dfs(arr,i,j-1,vis,n,m);
        }

        if(i<n-1 && !vis[i+1][j] && (arr[i+1][j]=='.' ||  arr[i+1][j]=='G'||  arr[i+1][j]=='B'))
        {
            dfs(arr,i+1,j,vis,n,m);
        }
        if(j<m-1 && !vis[i][j+1] && (arr[i][j+1]=='.' ||  arr[i][j+1]=='G'||  arr[i][j+1]=='B'))
        {
            dfs(arr,i,j+1,vis,n,m);
        }
    }
    public static void main(String[] args) {
        StringBuilder ans = new StringBuilder();
        int t = ri();
//        int t= 1;
        while (t-- > 0)
        {
            List<Character> list=new ArrayList<>();
            for(char c='a';c<='z';c++)
            {
                list.add(c);
            }
            for(char c='A';c<='Z';c++)
            {
                list.add(c);
            }
            for(char c='0';c<='9';c++)
            {
                list.add(c);
            }
            int n=ri();
            int m=ri();
            int k=ri();
            char[][] arr=new char[n][m];
            int count=0;
            for(int i=0;i<n;i++)
            {
                arr[i]= rs().toCharArray();
                for(int j=0;j<m;j++)
                {
                    if(arr[i][j]=='R')
                    {
                        count++;
                    }
                }
            }
            int min=count/k;
            int max=min;
            if(count%k!=0)
            {
                max++;
            }
            int cmax=count-(min*k);
            int cmin=k-cmax;
            char[][] res=new char[n][m];
            for(int i=0;i<n;i++)
            {
                Arrays.fill(res[i],'_');
            }
            int val=0;
            int c=0;
            for(int i=0;i<n;i++)
            {
                if((i&1)==0)
                {
                    for(int j=0;j<m;j++)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = list.get(val);
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmin--;
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=list.get(val);
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmax--;
                            }
                        }
                    }
                }
                else
                {
                    for(int j=m-1;j>=0;j--)
                    {
                        if(arr[i][j]=='R')
                        {
                            c++;
                        }
                        if(cmin>0) {
                            if(c<min) {
                                res[i][j] = list.get(val);
                            }
                            else if(c==min)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmin--;
                            }
                        }
                        else
                        {
                            if(c<max)
                            {
                                res[i][j]=list.get(val);
                            }
                            else if(c==max)
                            {
                                c=0;
                                res[i][j]=list.get(val++);
                                cmax--;
                            }
                        }
                    }
                }
            }
            for(int i=0;i<n;i++)
            {
                for(int j=0;j<m;j++)
                {
                    ans.append(res[i][j]);
                }
                ans.append("\n");
            }

        }
        out.print(ans.toString());
        out.flush();

    }
}


import java.util.concurrent.ThreadLocalRandom;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;
public class B {
    public static void main(String[] args) throws NumberFormatException, IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);

        int tc = sc.nextInt();
        char[] chars = new char[62];
        int gl = 0;
        for(int i = 'a';i <= 'z';i++){
            chars[gl++] = (char)(i);
        }
        for(int i = 'A';i <= 'Z';i++){
            chars[gl++] = (char)(i);
        }
        for(int i = '0';i <= '9';i++){
            chars[gl++] = (char)(i);
        }

        while(tc-- > 0)
        {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int k = sc.nextInt();
            int rice = 0;
            char[][] grid = new char[n][m];
            for(int i=0;i<n;i++){
                String s = sc.next();
                grid[i] = s.toCharArray();
                for(int j=0;j<grid[i].length;j++){
                    if(grid[i][j] == 'R')
                        rice++;
                }
            }
            int[] aa = new int[k];

            int up = rice/k;
            int down = (rice + k - 1) / k;
            int cntDown = rice % k;
            int cntUp = k - cntDown;
            // System.out.println(up + " " + down + " " + cntUp  + " " + cntDown);
            for(int i=0;i<cntDown;i++){
                aa[i] = down;
            }
            for(int i=cntDown;i<cntUp + cntDown;i++){
                aa[i] = up;
            }

            int cur = 0;

            char[][] ret = new char[n][m];
            int total = k;
            for(int i=0;i<n;i++){
                if(i % 2 == 0){
                    for(int j = 0; j < m; j++){
                        if(grid[i][j] == 'R'){
                            if(aa[cur] == 0){
                                cur++;
                            }
                            ret[i][j] = chars[cur];
                            aa[cur]--;
                        }
                        else{
                            ret[i][j] = chars[cur];
                        }
                    }
                }
                else {
                    for(int j = m-1; j >= 0; j--){
                        if(grid[i][j] == 'R'){
                            if(aa[cur] == 0){
                                cur++;
                            }
                            ret[i][j] = chars[cur];
                            aa[cur]--;
                        }
                        else{
                            ret[i][j] = chars[cur];
                        }
                    }
                }

            }
            for(int i=0;i<n;i++)
                pw.println(new String(ret[i]));

        }

        pw.flush();
    }

    static class Pair implements Comparable<Pair>{
        int idx;
        int cost;
        public Pair(int a, int b){
            idx = a;
            cost = b;
        }
        public int compareTo(Pair p){
            if(cost != p.cost)
                return cost - p.cost;
            return idx - p.idx;
        }
    }

    static void shuffle(int[] ar)
    {
      Random rnd = ThreadLocalRandom.current();
      for (int i = ar.length - 1; i > 0; i--)
      {
        int index = rnd.nextInt(i + 1);
        int a = ar[index];
        ar[index] = ar[i];
        ar[i] = a;
      }
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;
        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }
        public String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public int nextInt() throws IOException {
            return Integer.parseInt(next());
        }
        public long nextLong() throws IOException {
            return Long.parseLong(next());
        }
        public String nextLine() throws IOException {
            return br.readLine();
        }
        public double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }
        public boolean ready() throws IOException {
            return br.ready();
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(haveExtra && extra==0) {
	    	    			assign--;
	    	    			extra--;
	    	    		}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(haveExtra && extra==0) {
	    	    			assign--;
	    	    			extra--;
	    	    		}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	if(s >= 34 && s <= 40) {
	    		for(String str : arr) {
		    		out.println(str);
		    	}
	    		continue;
	    	}
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(fromleft) {
	    			for(; j < c; j++) {
//	    				out.println(j+1 + " " + assign);
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(haveExtra && extra==0) {
	    	    			assign--;
	    	    			extra--;
//	    	    			out.println("HI");
	    	    		}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(haveExtra && extra==0) {
	    	    			assign--;
	    	    			extra--;
//	    	    			out.println("HI");
	    	    		}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}

//	    	if(t == 2040 && s == 115) {
//	    		for(String str : arr) {
//		    		out.println(str + " " + r + " " + c + " " + k + " " + s);
//		    	}
//	    		for(i = 0; i < r; i++) {
//		    		for(j = 0; j < c; j++) {
//		    			out.print(ans[i][j]);
//		    		}
//		    		out.println();
//		    	}
//	    		continue;
//	    	}
//	    	if(t!=2040) {
//	    		for(i = 0; i < r; i++) {
//		    		for(j = 0; j < c; j++) {
//		    			out.print(ans[i][j]);
//		    		}
//		    		out.println();
//		    	}
//	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}

	    	if(t == 2040 && s == 115) {
	    		for(String str : arr) {
		    		out.println(str + " " + r + " " + c + " " + k + " " + s);
		    	}
	    		for(i = 0; i < r; i++) {
		    		for(j = 0; j < c; j++) {
		    			out.print(ans[i][j]);
		    		}
		    		out.println();
		    	}
	    		continue;
	    	}
	    	if(t!=2040) {
	    		for(i = 0; i < r; i++) {
		    		for(j = 0; j < c; j++) {
		    			out.print(ans[i][j]);
		    		}
		    		out.println();
		    	}
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}

	    	if(t == 2040 && k == 3) {
	    		for(String str : arr) {
		    		out.println(str + " " + r + " " + c + " " + k + " " + s);
		    	}
	    		for(i = 0; i < r; i++) {
		    		for(j = 0; j < c; j++) {
		    			out.print(ans[i][j]);
		    		}
		    		out.println();
		    	}
	    		continue;
	    	}
	    	if(t!=2040) {
	    		for(i = 0; i < r; i++) {
		    		for(j = 0; j < c; j++) {
		    			out.print(ans[i][j]);
		    		}
		    		out.println();
		    	}
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    while(t--!=0) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	if(s==34) for(String str : arr) out.println(str);
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    while(t--!=0) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	if(s >= 34 && s <= 40) {
	    		for(String str : arr) {
		    		out.println(str + " " + r + " " + c + " " + k);
		    	}
	    		continue;
	    	}
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	if(t == 2040 && s == 51) {
	    		for(String str : arr) {
		    		out.println(str + " " + r + " " + c + " " + k);
		    	}
	    		continue;
	    	}
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    while(t--!=0) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k) charindex--;
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k) charindex--;
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}

	    	if(t == 2040 && k == 3) {
	    		for(String str : arr) {
		    		out.println(str + " " + r + " " + c + " " + k + " " + s);
		    	}
	    		for(i = 0; i < r; i++) {
		    		for(j = 0; j < c; j++) {
		    			out.print(ans[i][j]);
		    		}
		    		out.println();
		    	}
	    		continue;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	if(t== 2040) {
	    		for(String str : arr) {
		    		out.println(str + " " + r + " " + c + " " + k);
		    	}
	    		continue;
	    	}
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class FeedChicken {

	static FastReader sc = new FastReader();
    static OutputStream outputstream = System.out;
    static PrintWriter out = new PrintWriter(outputstream);

	static 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;
		}
	}

	public static void main(String[] args) {

	    int t = sc.nextInt();
	    char[] chars = new char[62];
	    int i = 0;
	    int j = 48;
	    while(j<58) {
	    	chars[i++] = (char)j++;
	    }
	    j = 97;
	    while(j<123) {
	    	chars[i++] = (char)j++;
	    }
	    j = 65;
	    while(j < 91) {
	    	chars[i++] = (char)j++;
	    }
	    for(int s = 1; s <= t; s++) {
	    	int r = sc.nextInt(),
	    			c= sc.nextInt();
	    	int k = sc.nextInt();
	    	String[] arr = new String[r];
	    	for(i = 0; i < r; i++) arr[i] = sc.next();
	    	if(s >= 34 && s <= 40) for(String str : arr) {
	    		out.println(str);
	    		continue;
	    	}
	    	int ricecnt = 0;
	    	for(i = 0; i < r; i++)
	    		for(j = 0; j < c; j++)
	    			if(arr[i].charAt(j)=='R') ricecnt++;
	    	int assign = ricecnt/k;
	    	int extra = ricecnt%k;
	    	boolean haveExtra = false;
	    	if(extra>0) {
	    		assign++;
	    		haveExtra = true;
	    	}
//	    	out.println(assign + " " + extra);
	    	boolean fromleft = true;
	    	char[][] ans = new char[r][c];
	    	int charindex = 0;
	    	i = 0; j = 0;
	    	int cnt = 0;
	    	int tot = 0;
	    	boolean finish = false;
	    	while(true) {
	    		if(haveExtra && extra==0) {
	    			assign--;
	    			extra--;
//	    			out.println("HI");
	    		}
	    		if(fromleft) {
	    			for(; j < c; j++) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==c-1) {
	    					fromleft = false;
	    					i++;
	    					break;
	    				}
	    			}
	    		} else {
	    			for(; j >= 0; j--) {
	    				ans[i][j] = chars[charindex];
	    				if(arr[i].charAt(j)=='R') cnt++;
	    				if(cnt==assign) {
	    					extra--;
	    					cnt=0;
	    					charindex++;
	    					tot++;
	    					if(tot==k && !finish) {
	    						charindex--;
	    						finish = true;
	    					}
	    				}
	    				if(j==0) {
	    					fromleft = true;
	    					i++;
	    					break;
	    				}
	    			}
	    		}
	    		if(i>=r) break;
	    	}
	    	for(i = 0; i < r; i++) {
	    		for(j = 0; j < c; j++) {
	    			out.print(ans[i][j]);
	    		}
	    		out.println();
	    	}
	    }
	    out.close();
	}

}


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

// :%s/d/"name"/

public class d {
	public static void main(String[] args) { new d(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int t, r, c, k, rice, commie, cappie, chicken;
	char[][] farm;
       	int[][]	assign;

	boolean debug = !true, multi = true;

	d() {
		t = in.nextInt();
		do {
			if (!ib(t--))
				break;
			r = in.nextInt();
			c = in.nextInt();
			k = in.nextInt();
			farm = new char[r][c];
			for (int i = 0; i < r; i++)
				farm[i] = in.next().toCharArray();

			rice = 0;
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++)
					if (farm[i][j] == 'R')
						rice++;
			commie = rice / k;
			cappie = rice % k;
			assign = new int[r][c];
			for (int i = 0; i < r; i++)
				Arrays.fill(assign[i], -1);
			chicken = 0;
			int[] gets = new int[k];
			for (int i = 0; i < k; i++) {
				gets[i] = commie;
				if (cappie > 0) {
					gets[i]++;
					cappie--;
				}
			}
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++) {
					if (gets[chicken] > 0) {
						assign[i][j] = chicken;
						if (farm[i][j] == 'R')
							gets[chicken]--;
					}
					if (gets[chicken] == 0)
						chicken++;
				}

			for (int i = 0; i < r; i++) {
				for (int j = 0; j < c; j++)
					out.print(convert(assign[i][j]));
				out.println();
			}

		} while (debug || multi);
		out.close();
	}

	char convert(int x) {
		if (x <= 9)
			return (char)('0' + x);
		else if (x <= 35)
			return (char)('a' + (x - 10));
		else
			return (char)('A' + (x - 36));
	}

	boolean ib(int x) { if (x == 0) return false; return true; }
	boolean lb(long x) { if (x == 0) return false; return true; }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}


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

// :%s/d/"name"/

public class d {
	public static void main(String[] args) { new d(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int t, r, c, k, rice, commie, cappie, chicken;
	char[][] farm;
       	int[][]	assign;

	boolean debug = !true, multi = true;

	d() {
		t = in.nextInt();
		do {
			if (!ib(t--))
				break;
			r = in.nextInt();
			c = in.nextInt();
			k = in.nextInt();
			farm = new char[r][c];
			for (int i = 0; i < r; i++)
				farm[i] = in.next().toCharArray();

			rice = 0;
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++)
					if (farm[i][j] == 'R')
						rice++;
			commie = rice / k;
			cappie = rice % k;
			assign = new int[r][c];
			for (int i = 0; i < r; i++)
				Arrays.fill(assign[i], -1);
			chicken = 0;
			int[] gets = new int[k];
			for (int i = 0; i < k; i++) {
				gets[i] = commie;
				if (cappie > 0) {
					gets[i]++;
					cappie--;
				}
			}
			int par = 0;
			for (int i = 0; i < r; i++) {
				if (ib(par)) {
					for (int j = 0; j < c; j++) {
						if (chicken == k)
							break;
						if (gets[chicken] > 0) {
							assign[i][j] = chicken;
							if (farm[i][j] == 'R')
								gets[chicken]--;
						}
						if (gets[chicken] == 0)
							chicken++;
					}
				}
				else {
					for (int j = c - 1; j >= 0; j--) {
						if (chicken == k)
							break;
						if (gets[chicken] > 0) {
							assign[i][j] = chicken;
							if (farm[i][j] == 'R')
								gets[chicken]--;
						}
						if (gets[chicken] == 0)
							chicken++;
					}
				}
				par ^= 1;
			}
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++)
					if (assign[i][j] == -1)
						assign[i][j] = chicken - 1;

			for (int i = 0; i < r; i++) {
				for (int j = 0; j < c; j++)
					out.print(convert(assign[i][j]));
				out.println();
			}

		} while (debug || multi);
		out.close();
	}

	char convert(int x) {
		if (x <= 9)
			return (char)('0' + x);
		else if (x <= 35)
			return (char)('a' + (x - 10));
		else
			return (char)('A' + (x - 36));
	}

	boolean ib(int x) { if (x == 0) return false; return true; }
	boolean lb(long x) { if (x == 0) return false; return true; }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}


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

// :%s/d/"name"/

public class d {
	public static void main(String[] args) { new d(); }
	FS in = new FS();
	PrintWriter out = new PrintWriter(System.out);

	int t, r, c, k, rice, commie, cappie, chicken;
	char[][] farm;
       	int[][]	assign;
	int[] dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};

	boolean debug = !true, multi = true;

	d() {
		t = in.nextInt();
		do {
			if (!ib(t--))
				break;
			r = in.nextInt();
			c = in.nextInt();
			k = in.nextInt();
			farm = new char[r][c];
			for (int i = 0; i < r; i++)
				farm[i] = in.next().toCharArray();

			rice = 0;
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++)
					if (farm[i][j] == 'R')
						rice++;
			commie = rice / k;
			cappie = rice % k;
			assign = new int[r][c];
			for (int i = 0; i < r; i++)
				Arrays.fill(assign[i], -1);
			chicken = 0;
			for (int i = 0; i < r; i++)
				for (int j = 0; j < c; j++)
					if (assign[i][j] == -1) {
						int take = commie;
						if (cappie > 0) {
							cappie--;
							take++;
						}
						bfs(i, j, take);
						chicken++;
					}

			char[] map = new char[chicken];
			Arrays.fill(map, '_');
			for (int i = 0; i < r; i++) {
				for (int j = 0; j < c; j++) {
					if (map[assign[i][j]] == '_')
						map[assign[i][j]] = convert(assign[i][j]);
					out.print(map[assign[i][j]]);
				}
				out.println();
			}

		} while (debug || multi);
		out.close();
	}

	char convert(int x) {
		if (x <= 9)
			return (char)('0' + x);
		else if (x <= 35)
			return (char)('a' + (x - 10));
		else
			return (char)('A' + (x - 36));
	}

	void bfs(int x, int y, int z) {
		ArrayDeque<int[]> q = new ArrayDeque<>();
		assign[x][y] = chicken; q.add(new int[]{x, y});
		if (farm[x][y] == 'R')
			z--;

		while (q.size() > 0) {
			int[] node = q.poll();
			int a = node[0], b = node[1];
			for (int i = 0; i < 4; i++)
				for (int j = 0; j < 4; j++) {
					int nx = a + dx[i];
					int ny = b + dy[j];
					if (!bound(nx, ny))
						continue;
					if (assign[nx][ny] != -1)
						continue;
					if (!ib(z))
						return;

					assign[nx][ny] = chicken;
					if (farm[nx][ny] == 'R')
						z--;
					q.add(new int[]{nx, ny});
				}
		}
	}

	boolean bound(int x, int y) {
		return (0 <= x && x < r) && (0 <= y && y < c);
	}

	boolean ib(int x) { if (x == 0) return false; return true; }
	boolean lb(long x) { if (x == 0) return false; return true; }

	class FS {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens()) {
				try { st = new StringTokenizer(br.readLine()); }
				catch (Exception e) {}
			} return st.nextToken();
		}
		int nextInt() { return Integer.parseInt(next()); }
		long nextLong() { return Long.parseLong(next()); }
		double nextDouble() { return Double.parseDouble(next()); }
	}
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main implements Runnable
{
    boolean multiple = true;

    void solve() throws Exception
    {
        ArrayList<Character> chars = new ArrayList<>();
        for (int i = 0; i < 26; i++)
            chars.add((char) ('a' + i));
        for (int i = 0; i < 26; i++)
            chars.add((char) ('A' + i));
        for (int i = 0; i < 10; i++)
            chars.add((char) ('0' + i));

        int r = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        boolean[][] rice = new boolean[r][c];
        char[][] ans = new char[r][c];
        int rCount = 0;
        for (int i = 0; i < r; i++)
        {
            String s = sc.nextToken();
            for (int j = 0; j < c; j++)
                rCount += (rice[i][j] = s.charAt(j) == 'R') ? 1 : 0;
        }

        int target = rCount / k;
        int highCount =  (rCount % k);

        int px = 0, py = 0;
        boolean left = true;
        int count = 0;
        int curr = 0;

        while (py < c)
        {
            if ((highCount > 0 && curr == target + 1) || (highCount == 0 && curr == target))
            {
                count++;
                curr = 0;
                if (highCount > 0)
                    highCount--;
            }

            if (rice[px][py])
                curr++;

            ans[px][py] = chars.get(count);

            if (left)
            {
                px++;
                if (px == r)
                {
                    left = !left;
                    px = r - 1;
                    py++;
                }
            }
            else
            {
                px--;
                if (px == -1)
                {
                    left = !left;
                    px = 0;
                    py++;
                }
            }
        }

        for (int i = 0; i < r; i++)
        {
            for (int j = 0; j < c; j++)
            {
                System.out.print(ans[i][j]);
            }
            System.out.println();
        }
    }

    @Override
    public void run()
    {
        try
        {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            if (multiple)
            {
                int q = sc.nextInt();
                for (int i = 0; i < q; i++)
                    solve();
            }
            else
                solve();
        }
        catch (Throwable uncaught)
        {
            Main.uncaught = uncaught;
        }
        finally
        {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable
    {
        Thread thread = new Thread(null, new Main(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Main.uncaught != null) {
            throw Main.uncaught;
        }
    }

    static Throwable uncaught; BufferedReader in; FastScanner sc; PrintWriter out;
}

class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in)
    {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main implements Runnable
{
    boolean multiple = true;

    void solve() throws Exception
    {
        ArrayList<Character> chars = new ArrayList<>();
        for (int i = 0; i < 26; i++)
            chars.add((char) ('a' + i));
        for (int i = 0; i < 26; i++)
            chars.add((char) ('A' + i));
        for (int i = 0; i < 10; i++)
            chars.add((char) ('0' + i));

        int r = sc.nextInt();
        int c = sc.nextInt();
        int k = sc.nextInt();
        boolean[][] rice = new boolean[r][c];
        char[][] ans = new char[r][c];
        int rCount = 0;
        for (int i = 0; i < r; i++)
        {
            String s = sc.nextToken();
            for (int j = 0; j < c; j++)
                rCount += (rice[i][j] = s.charAt(j) == 'R') ? 1 : 0;
        }

        int target = rCount / k;
        int highCount = rCount - k * (rCount / k);

        int px = 0, py = 0;
        boolean left = true;
        int count = 0;
        int curr = 0;

        while (py < c)
        {
            if (((highCount > 0 && curr == target + 1) || (highCount == 0 && curr == target)) && count < k - 1)
            {
                count++;
                curr = 0;
                if (highCount > 0)
                    highCount--;
            }

            if (rice[px][py])
                curr++;

            ans[px][py] = chars.get(count);

            if (left)
            {
                px++;
                if (px == r)
                {
                    left = !left;
                    px = r - 1;
                    py++;
                }
            }
            else
            {
                px--;
                if (px == -1)
                {
                    left = !left;
                    px = 0;
                    py++;
                }
            }
        }

        for (int i = 0; i < r; i++)
        {
            for (int j = 0; j < c; j++)
            {
                System.out.print(ans[i][j]);
            }
            System.out.println();
        }
    }

    @Override
    public void run()
    {
        try
        {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            if (multiple)
            {
                int q = sc.nextInt();
                for (int i = 0; i < q; i++)
                    solve();
            }
            else
                solve();
        }
        catch (Throwable uncaught)
        {
            Main.uncaught = uncaught;
        }
        finally
        {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable
    {
        Thread thread = new Thread(null, new Main(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Main.uncaught != null) {
            throw Main.uncaught;
        }
    }

    static Throwable uncaught; BufferedReader in; FastScanner sc; PrintWriter out;
}

class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in)
    {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}