#include <bits/stdc++.h>
using namespace std;
vector<char> inp;
int main() {
  for (char i = '0'; i <= '9'; i++) inp.push_back(i);
  for (char i = 'a'; i <= 'z'; i++) inp.push_back(i);
  for (char i = 'A'; i <= 'Z'; i++) inp.push_back(i);
  int TC;
  cin >> TC;
  while (TC--) {
    int n, m, k, r = 0;
    vector<string> v, res;
    vector<int> pabe;
    string s;
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
      cin >> s;
      v.push_back(s);
    }
    res = v;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (v[i][j] == 'R') r++;
      }
    }
    for (int i = 0; i < k; i++) {
      pabe.push_back(r / k);
    }
    int rem = r % k;
    for (int i = 0; i < k; i++) {
      if (rem) {
        pabe[i]++;
        rem--;
      }
    }
    int cur = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < m; j++) {
          res[i][j] = inp[cur];
          if (v[i][j] == 'R') {
            pabe[cur]--;
            if (pabe[cur] == 0 && cur < (k - 1)) cur++;
          }
        }
      } else {
        for (int j = m - 1; j >= 0; j--) {
          res[i][j] = inp[cur];
          if (v[i][j] == 'R') {
            pabe[cur]--;
            if (pabe[cur] == 0 && cur < (k - 1)) cur++;
          }
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << res[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}
