#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 1;
const int NN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long oo = 1e18 + 7;
const int BASE = 10000;
vector<char> ch(62);
void init() {
  for (int i = 0; i < 26; i++) {
    ch[i] = 'a' + i;
  }
  for (int i = 26; i < 52; i++) {
    ch[i] = 'A' + (i - 26);
  }
  for (int i = 52; i < 62; i++) {
    ch[i] = '0' + (i - 52);
  }
}
void query() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<char>> a(n + 1, vector<char>(m + 1));
  int R = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'R') {
        R++;
      }
    }
  }
  int pos = 1, cnt = 0, pow = (R + k - 1) / k;
  vector<vector<char>> res(n + 1, vector<char>(m + 1));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int col = (i % 2) ? j : (m - j + 1);
      if (pos > k) {
        res[i][col] = ch[pos - 2];
        continue;
      }
      if (a[i][col] == '.') {
        res[i][col] = ch[pos - 1];
        continue;
      }
      res[i][col] = ch[pos - 1];
      cnt++;
      if (cnt == pow) {
        cnt = 0;
        pos++;
        pow = (pos <= R % k) ? (R + k - 1) / k : R / k;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cout << res[i][j];
    }
    cout << "\n";
  }
}
void solve() {
  int q;
  cin >> q;
  init();
  while (q--) {
    query();
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(10);
  solve();
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  return 0;
}
