#include <bits/stdc++.h>
using namespace std;
long long t, ntest;
long long n, m, k, cnt;
char a[105][105], b[105][105];
string s = " 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
void input() {
  cnt = 0;
  cin >> n >> m >> k;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      cin >> a[i][j];
      if (a[i][j] == 'R') cnt++;
    }
  }
}
void solve() {
  long long p = cnt / k, q = cnt % k;
  long long tmp = 1, d = 0;
  for (long long i = 1; i <= n; i++) {
    if (i % 2 == 1) {
      for (long long j = 1; j <= m; j++) {
        if (a[i][j] == '.')
          b[i][j] = s[tmp];
        else {
          b[i][j] = s[tmp];
          d++;
          if (d == p + 1 && tmp <= q) {
            tmp++;
            d = 0;
          } else if (d == p && tmp > q && tmp < k) {
            tmp++;
            d = 0;
          }
        }
      }
    } else {
      for (long long j = m; j >= 1; j--) {
        if (a[i][j] == '.')
          b[i][j] = s[tmp];
        else {
          b[i][j] = s[tmp];
          d++;
          if (d == p + 1 && tmp <= q) {
            tmp++;
            d = 0;
          } else if (d == p && tmp > q && tmp < k) {
            tmp++;
            d = 0;
          }
        }
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) cout << b[i][j];
    cout << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  for (ntest = 1; ntest <= t; ntest++) {
    input();
    solve();
  }
}
