#include <bits/stdc++.h>
using namespace std;
inline void read(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void read(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = (c & 15);
  while (isdigit(c = getchar())) v = (v << 1) + (v << 3) + (c & 15);
  x = v * f;
}
inline void readc(char &x) {
  char c;
  while (((c = getchar()) == ' ') || c == '\n')
    ;
  x = c;
}
inline void writes(string s) { puts(s.c_str()); }
inline void writeln() { writes(""); }
inline void writei(int x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
inline void writell(long long x) {
  if (x < 0) {
    putchar('-');
    x = abs(x);
  }
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
int t, n, m, k, i, j, px[10005], py[10005], vis[105][105];
char a[105][105], b[105][105];
char id(int x) {
  if (x <= 10) return x + '0' - 1;
  if (x <= 36) return x + 'a' - 11;
  return x + 'A' - 37;
}
int main() {
  read(t);
  while (t--) {
    read(n);
    read(m);
    read(k);
    int s = 0;
    for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
      for (((j)) = (1); ((j)) <= ((m)); ((j))++) {
        readc(a[i][j]);
        s += (a[i][j] == 'R');
      }
    }
    int x = 1, y = 1, dir = 0;
    memset(vis, 1, sizeof(vis));
    for (((i)) = (1); ((i)) <= ((n)); ((i))++)
      for (((j)) = (1); ((j)) <= ((m)); ((j))++) vis[i][j] = 0;
    for (((i)) = (1); ((i)) <= ((n * m)); ((i))++) {
      vis[x][y] = 1;
      px[i] = x;
      py[i] = y;
      if (i == n * m) break;
      while (vis[x + dx[dir]][y + dy[dir]]) (dir += 1) %= 4;
      x += dx[dir];
      y += dy[dir];
    }
    if (s < k) {
      int c = 0;
      for (((i)) = (1); ((i)) <= ((n * m)); ((i))++) {
        if (a[px[i]][py[i]] == 'R') {
          b[px[i]][py[i]] = id(++c);
        }
      }
      for (((i)) = (1); ((i)) <= ((n * m)); ((i))++) {
        if (a[px[i]][py[i]] != 'R') {
          if (c < k)
            b[px[i]][py[i]] = id(++c);
          else
            b[px[i]][py[i]] = b[px[i - 1]][py[i - 1]];
        }
      }
      for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
        for (((j)) = (1); ((j)) <= ((m)); ((j))++) {
          putchar(b[i][j]);
        }
        puts("");
      }
      continue;
    }
    int lst = 0;
    for (((i)) = (1); ((i)) <= ((k)); ((i))++) {
      int t = s / k;
      if (i <= s % k) t++;
      while (t) {
        lst++;
        t -= (a[px[lst]][py[lst]] == 'R');
        b[px[lst]][py[lst]] = id(i);
      }
    }
    while (lst < n * m) {
      lst++;
      b[px[lst]][py[lst]] = id(k);
    }
    for (((i)) = (1); ((i)) <= ((n)); ((i))++) {
      for (((j)) = (1); ((j)) <= ((m)); ((j))++) {
        putchar(b[i][j]);
      }
      puts("");
    }
  }
  return 0;
}
