#include <bits/stdc++.h>
using namespace std;
static auto faster_iostream = []() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return 0;
}();
bool a[105][105];
int ans[105][105];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m, k, tot = 0;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) {
      string tmp;
      cin >> tmp;
      for (int j = 0; j < m; j++) tot += (a[i][j] = (tmp[j] == 'R'));
    }
    int now = 0, cnt = (tot + k - 1 - now) / k;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < m; j++) {
          if (a[i][j]) {
            if (cnt == 0) {
              now++;
              cnt = (tot + k - 1 - now) / k;
            }
            cnt--;
          }
          ans[i][j] = now;
        }
      } else {
        for (int j = m - 1; j >= 0; j--) {
          if (a[i][j]) {
            if (cnt == 0) {
              now++;
              cnt = (tot + k - 1 - now) / k;
            }
            cnt--;
          }
          ans[i][j] = now;
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (ans[i][j] < 10)
          cout << ans[i][j];
        else if (ans[i][j] < 36)
          cout << (char)(ans[i][j] - 10 + 'a');
        else
          cout << (char)(ans[i][j] - 36 + 'A');
      }
      cout << endl;
    }
  }
}
