#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int t;
  cin >> t;
  while (t--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> a(n);
    int rice = 0;
    for (int i = 0; i < n; ++i) {
      cin >> a[i];
      rice += count(a[i].begin(), a[i].end(), 'R');
    }
    int totRice = rice;
    int ver = (rice + k - 1) / k;
    rice /= k;
    vector<char> chickens;
    for (char c = 'a'; c <= 'z'; ++c) chickens.push_back(c);
    for (char c = 'A'; c <= 'Z'; ++c) chickens.push_back(c);
    for (char c = '0'; c <= '9'; ++c) chickens.push_back(c);
    int cur = 0, num = 0;
    vector<string> ans(n);
    for (int i = 0; i < n; ++i) ans[i] = string(m, '?');
    int magic = (k - (ver * k - totRice));
    if (magic == k) magic = 0;
    for (int i = 0; i < n; ++i) {
      if (i % 2)
        for (int j = 0; j < m; ++j) {
          if (a[i][j] == 'R') {
            if (cur + 1 > rice + ((num < magic) ? 1 : 0)) {
              chickens.pop_back();
              cur = 0;
              ++num;
            }
            ++cur;
          }
          ans[i][j] = chickens.back();
        }
      else
        for (int j = m - 1; j >= 0; --j) {
          if (a[i][j] == 'R') {
            if (cur + 1 > rice + ((num < magic) ? 1 : 0)) {
              chickens.pop_back();
              cur = 0;
              ++num;
            }
            ++cur;
          }
          ans[i][j] = chickens.back();
        }
    }
    for (int i = 0; i < n; ++i) cout << ans[i] << '\n';
  }
}
