#include <bits/stdc++.h>
using namespace std;
long long t, n, m, k;
char mc[107][107];
long long l, ost, curr, now;
int used[107][107];
void dfs(int r, int c);
void check(int r, int c) {
  if (r > n || r < 1 || c > m || c < 1 || used[r][c]) return;
  dfs(r, c);
}
void dfs(int r, int c) {
  used[r][c] = curr;
  now += mc[r][c] == 'R';
  if (now == l + (curr <= ost) && curr < k) {
    now = 0;
    curr++;
  }
  check(r, c - 1);
  check(r + 1, c);
  check(r, c + 1);
  check(r - 1, c);
}
int main() {
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    long long p = 0;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= m; ++j) {
        cin >> mc[i][j];
        if (mc[i][j] == 'R') p++;
      }
    l = p / k;
    ost = p % k;
    curr = 1;
    now = 0;
    dfs(1, 1);
    for (int r = 1; r <= n; ++r) {
      for (int c = 1; c <= m; ++c) {
        if (used[r][c] <= 10)
          cout << char(used[r][c] + '0' - 1);
        else if (used[r][c] <= 10 + 26)
          cout << char('a' + (used[r][c] - 10 - 1));
        else
          cout << char('A' + used[r][c] - 10 - 26 - 1);
        used[r][c] = 0;
      }
      cout << endl;
    }
  }
  return 0;
}
