#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, i, r, c, j, k, total, chic_rice, curr, chic_num;
  cin >> t;
  while (t--) {
    cin >> r >> c >> k;
    total = 0;
    vector<string> mat(r);
    vector<vector<long long int> > ans(r);
    for (i = 0; i < r; i++) {
      cin >> mat[i];
      ans[i] = vector<long long int>(c);
      for (j = 0; j < c; j++)
        if (mat[i][j] == 'R') total++;
    }
    chic_rice = total / k;
    chic_num = 1;
    curr = 0;
    for (i = 0; i < r; i++) {
      if (i % 2) {
        for (j = c - 1; j >= 0; j--) {
          if (mat[i][j] == 'R') curr++;
          if (total % k && curr > chic_rice + 1 ||
              total % k == 0 && curr > chic_rice) {
            chic_num++;
            curr = 1;
            if (total % k) total--;
          }
          ans[i][j] = chic_num;
        }
      } else {
        for (j = 0; j < c; j++) {
          if (mat[i][j] == 'R') curr++;
          if (total % k && curr > chic_rice + 1 ||
              total % k == 0 && curr > chic_rice) {
            chic_num++;
            curr = 1;
            if (total % k) total--;
          }
          ans[i][j] = chic_num;
        }
      }
      for (j = 0; j < c; j++) {
        if (ans[i][j] <= 10)
          cout << (char)('0' + ans[i][j] - 1);
        else if (ans[i][j] <= 36)
          cout << (char)('a' + ans[i][j] - 11);
        else
          cout << (char)('A' + ans[i][j] - 37);
      }
      cout << '\n';
    }
  }
}
