#include <bits/stdc++.h>
using namespace std;
int n, t, m, num, jl, js, mod, sha, cnt, k;
char s[110][110];
int a[110][110];
void find(int x, int y, int u, int dic) {
  if (x == n + 1) return;
  int p = u;
  if (s[x][y] == 'R') {
    a[x][y] = u;
    jl++;
    if (jl == sha) {
      jl = 0;
      if (k - p == mod) sha++;
      if (p < k) p++;
    }
  } else {
    a[x][y] = u;
  }
  if (dic == 1) {
    if (y < m)
      find(x, y + 1, p, dic);
    else
      find(x + 1, y, p, -dic);
  } else {
    if (y > 1)
      find(x, y - 1, p, dic);
    else
      find(x + 1, y, p, -dic);
  }
  return;
}
int main() {
  scanf("%d", &t);
  for (int o = 1; o <= t; o++) {
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
    num = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (s[i][j] == 'R') num++;
        a[i][j] = 0;
      }
    }
    sha = num / k;
    mod = num % k;
    jl = 0;
    find(1, 1, 1, 1);
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (a[i][j] <= 26)
          printf("%c", char(a[i][j] + 'A' - 1));
        else if (a[i][j] <= 52)
          printf("%c", char(a[i][j] + 'a' - 27));
        else
          printf("%d", a[i][j] - 53);
      }
      printf("\n");
    }
  }
  return 0;
}
