#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 12;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-10;
char ch(int c) {
  if (c < 10)
    return '0' + c;
  else if (c < 36)
    return 'A' + (c - 10);
  else
    return 'a' + (c - 36);
}
char in[105][105];
pair<int, int> ran[105];
char ans[105][105];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int R, C, K, i, j;
    scanf("%d %d %d", &R, &C, &K);
    int cnt = 0;
    for (i = 0; i < R; i++) {
      scanf("%s", in[i]);
      for (j = 0; j < C; j++)
        if (in[i][j] == 'R') cnt++;
    }
    vector<pair<int, int> > Vl;
    for (i = 0; i < R; i++) {
      if (i % 2 == 0)
        for (j = 0; j < C; j++) Vl.emplace_back(i, j);
      else
        for (j = C - 1; j >= 0; j--) Vl.emplace_back(i, j);
    }
    int p = 0;
    int tidx = 0;
    for (i = 0; i < K; i++) {
      int c = cnt / K;
      if (i < cnt % K) c++;
      if (p == Vl.size()) {
        int x1 = ran[tidx].first, x2 = ran[tidx].second;
        while (x1 != x2) tidx++;
        if (in[Vl[x1].first][Vl[x1].second] == 'R') {
          ran[i] = pair<int, int>(x2, x2);
          ran[tidx].second--;
        } else {
          ran[i] = pair<int, int>(x1, x1);
          ran[tidx].first++;
        }
        continue;
      }
      ran[i].first = p;
      while (1) {
        if (in[Vl[p].first][Vl[p].second] == 'R') c--;
        if (c == 0) break;
        p++;
      }
      ran[i].second = p;
      p++;
      if (i == K - 1) ran[i].second = Vl.size() - 1;
    }
    for (i = 0; i < K; i++)
      for (j = ran[i].first; j <= ran[i].second; j++)
        ans[Vl[j].first][Vl[j].second] = ch(i);
    for (i = 0; i < R; i++) {
      for (j = 0; j < C; j++) printf("%c", ans[i][j]);
      printf("\n");
    }
  }
  return 0;
}
