#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
long long t, n, m, k;
vector<char> v;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (char c = 'a'; c <= 'z'; c++) v.push_back(c);
  for (char c = 'A'; c <= 'Z'; c++) v.push_back(c);
  for (char c = '0'; c <= '9'; c++) v.push_back(c);
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    char arr[n + 5][m + 5];
    long long cnt = 0, r = 0, c = 0, ind = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) cin >> arr[i][j], cnt += (arr[i][j] == 'R');
    for (int i = 0; i < cnt % k; i++) {
      long long cnt1 = cnt / k + 1;
      while (cnt1) {
        cnt1 -= (arr[r][c] == 'R');
        arr[r][c] = v[ind];
        c = (c + 1 - 2 * (r & 1));
        if (c == -1) r++, c = 0;
        if (c == m) r++, c = m - 1;
      }
      ind++;
    }
    for (int i = cnt % k; i < k; i++) {
      long long cnt1 = cnt / k;
      while (cnt1) {
        cnt1 -= (arr[r][c] == 'R');
        arr[r][c] = v[ind];
        c = (c + 1 - 2 * (r & 1));
        if (c == -1) r++, c = 0;
        if (c == m) r++, c = m - 1;
      }
      ind++;
    }
    while (r < n) {
      arr[r][c] = v[ind - 1];
      c = (c + 1 - 2 * (r & 1));
      if (c == -1) r++, c = 0;
      if (c == m) r++, c = m - 1;
    }
    for (int i = 0; i < n; i++, cout << endl)
      for (int j = 0; j < m; j++) cout << arr[i][j];
  }
  return 0;
}
