#include <bits/stdc++.h>
using namespace std;
char a[200][200], b[100], c[200][200];
int main() {
  int k = 0;
  for (int i = '0'; i <= '9'; i++) b[k++] = i;
  for (int i = 'A'; i <= 'Z'; i++) b[k++] = i;
  for (int i = 'a'; i <= 'z'; i++) b[k++] = i;
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m, h;
    scanf("%d %d %d", &n, &m, &h);
    for (int i = 1; i <= n; i++) scanf("%s", a[i] + 1);
    int sum = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        if (a[i][j] == 'R') sum++;
      }
    int x = sum / h;
    int y = sum % h;
    int l = 0, r;
    int xxx = 0;
    if (l < y)
      r = x + 1;
    else
      r = x;
    for (int i = 1; i <= n; i++) {
      if (i % 2) {
        for (int j = 1; j <= m; j++) {
          if (xxx == h) {
            c[i][j] = b[l - 1];
            continue;
          }
          c[i][j] = b[l];
          if (a[i][j] == 'R') r--;
          if (r == 0) {
            xxx++;
            l++;
            if (l < y)
              r = x + 1;
            else
              r = x;
          }
        }
      } else {
        for (int j = m; j >= 1; j--) {
          if (xxx == h) {
            c[i][j] = b[l - 1];
            continue;
          }
          c[i][j] = b[l];
          if (a[i][j] == 'R') r--;
          if (r == 0) {
            xxx++;
            l++;
            if (l < y)
              r = x + 1;
            else
              r = x;
          }
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) printf("%c", c[i][j]);
      printf("\n");
    }
  }
  return 0;
}
