#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double PI = acos(-1);
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const long double eps = 1e-9;
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, m, k;
    cin >> n >> m >> k;
    char s[n + 1][m + 1];
    long long cnt = 0;
    for (long long i = 1; i < n + 1; i++) {
      for (long long j = 1; j <= m; j++) {
        cin >> s[i][j];
        cnt += (s[i][j] == 'R');
      }
    }
    long long w[k + 1];
    for (long long i = 1; i <= k; i++) {
      if (cnt % k >= i) {
        w[i] = cnt / k + 1;
      } else
        w[i] = cnt / k;
    }
    long long idx = 1;
    char f = '0';
    char ans[n + 1][m + 1];
    for (long long i = 1; i <= n; i++) {
      for (long long j = (i & 1) ? 1 : m; j >= 1 && j <= m;
           j += (i & 1) ? 1 : -1) {
        if (!w[idx] && s[i][j] == 'R') {
          idx++;
          f++;
          if (f == '9' + 1) f = 'A';
          if (f == 'Z' + 1) f = 'a';
        }
        w[idx] -= (s[i][j] == 'R');
        ans[i][j] = f;
      }
    }
    for (long long i = 1; i <= n; i++) {
      for (long long j = 1; j <= m; j++) {
        cout << ans[i][j];
      }
      cout << endl;
    }
  }
}
