#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
vector<char> cc;
void solve() {
  int n, m, k, d = 0;
  cin >> n >> m >> k;
  vector<string> arr(n), ans(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    ans[i].resize(m);
    for (int j = 0; j < m; j++) d += (arr[i][j] == 'R');
  }
  vector<int> cnt;
  for (int i = 0; i < k - d % k; i++) cnt.push_back(d / k);
  for (int i = 0; i < d % k; i++) cnt.push_back(d / k + 1);
  vector<int> have(k);
  int ptr = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < m; j++) {
        char cur = cc[ptr];
        ans[i][j] = cur;
        have[ptr] += (arr[i][j] == 'R');
        if (have[ptr] == cnt[ptr] && ptr < k - 1) ptr++;
      }
    } else {
      for (int j = m - 1; j >= 0; j--) {
        char cur = cc[ptr];
        ans[i][j] = cur;
        have[ptr] += (arr[i][j] == 'R');
        if (have[ptr] == cnt[ptr] && ptr < k - 1) ptr++;
      }
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << '\n';
}
int main() {
  srand(1373737);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  for (char c = '0'; c <= '9'; c++) cc.push_back(c);
  for (char c = 'a'; c <= 'z'; c++) cc.push_back(c);
  for (char c = 'A'; c <= 'Z'; c++) cc.push_back(c);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
