#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  string cnv;
  cnv.reserve(62);
  for (char i = 'a'; i <= 'z'; ++i) {
    cnv.push_back(i);
  }
  for (char i = 'A'; i <= 'Z'; ++i) {
    cnv.push_back(i);
  }
  for (char i = '0'; i <= '9'; ++i) {
    cnv.push_back(i);
  }
  for (int i = 0; i < t; ++i) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> mas(n);
    int cnt = 0;
    for (int j = 0; j < n; ++j) {
      cin >> mas[j];
      for (char c : mas[j]) {
        cnt += (c == 'R');
      }
    }
    int cur = 0;
    int perc = cnt / k;
    int bigger = cnt % k;
    int curcnt = 0;
    for (int i = 0; i < n; ++i) {
      if (i & 1) {
        for (int j = 0; j < m; ++j) {
          if (mas[i][j] == 'R' && curcnt == perc + (cur < bigger)) {
            ++cur;
            curcnt = 0;
          }
          if (mas[i][j] == 'R') ++curcnt;
          mas[i][j] = cnv[cur];
        }
      } else {
        for (int j = m - 1; j >= 0; --j) {
          if (mas[i][j] == 'R' && curcnt == perc + (cur < bigger)) {
            ++cur;
            curcnt = 0;
          }
          if (mas[i][j] == 'R') ++curcnt;
          mas[i][j] = cnv[cur];
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      cout << mas[i] << '\n';
    }
  }
  return 0;
}
