#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
void init() {
  ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
}
char conv(int a) {
  if (a < 10) return a + '0';
  if (a < 36) return a - 10 + 'A';
  if (a < 62) return a - 36 + 'a';
  return 0;
}
int main() {
  init();
  int T;
  cin >> T;
  while (T--) {
    int r, c, k;
    cin >> r >> c >> k;
    vector<string> a(r, string(""));
    for (int i = 0; i < r; i++) cin >> a[i];
    int cnt = 0;
    for (int i = 0; i < r; i++)
      for (int j = 0; j < c; j++) cnt += (a[i][j] == 'R');
    int avg = cnt / k;
    int rem = cnt % k;
    int tot = 0;
    int ric = 0;
    for (int i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < c; j++) {
          if (a[i][j] == 'R') ric++;
          a[i][j] = conv(tot);
          if ((tot < rem && ric == avg + 1) || (tot >= rem && ric == avg)) {
            tot++;
            ric = 0;
          }
          if (tot == k) tot = k - 1;
        }
      } else {
        for (int j = c - 1; j >= 0; j--) {
          if (a[i][j] == 'R') ric++;
          a[i][j] = conv(tot);
          if ((tot < rem && ric == avg + 1) || (tot >= rem && ric == avg)) {
            tot++;
            ric = 0;
          }
          if (tot == k) tot = k - 1;
        }
      }
    }
    for (int i = 0; i < r; i++) cout << a[i] << endl;
  }
}
