#include <bits/stdc++.h>
using namespace std;
const int maxn = 70;
int n, m, k;
int c[maxn];
char s[120][120];
char ans[120][120];
char getc(int x) {
  if (x >= 1 && x <= 10)
    return x - 1 + '0';
  else if (x > 10 && x <= 36)
    return x + 'a' - 11;
  else
    return x + 'A' - 37;
}
int t;
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d", &n, &m, &k);
    int x = 0;
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++)
        if (s[i][j] == 'R') x++;
    }
    for (int i = 1; i <= k; i++) c[i] = x / k;
    for (int i = 1; i <= x % k; i++) c[i]++;
    int f = 0;
    int p = 1;
    int r = 0;
    for (int i = 1; i <= n; i++) {
      if (!f) {
        f = 1;
        for (int j = m; j >= 1; j--) {
          if (s[i][j] == 'R') {
            r++;
          }
          ans[i][j] = getc(p);
          if (r == c[p] && p < k) p++, r = 0;
        }
      } else {
        f = 0;
        for (int j = 1; j <= m; j++) {
          if (s[i][j] == 'R') {
            r++;
          }
          ans[i][j] = getc(p);
          if (r == c[p] && p < k) p++, r = 0;
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) printf("%c", ans[i][j]);
      printf("\n");
    }
  }
  return 0;
}
