#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 7;
long long tc, n, m, a, b, r, c, i, j, k, l;
long long ar[105][105], flag[10005];
char ckn[70], ans[105][105];
string s;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> tc;
  for (i = 0; i < 26; i++) ckn[i] = 'a' + i;
  for (i = 0; i < 26; i++) ckn[i + 26] = 'A' + i;
  for (i = 0; i < 10; i++) ckn[i + 52] = '0' + i;
  while (tc--) {
    long long cnt = 0;
    cin >> r >> c >> n;
    long long mx = max(r, c);
    for (i = 0; i < r; i++)
      for (j = 0; j < c; j++) flag[i * mx + j] = 0;
    for (i = 0; i < r; i++) {
      cin >> s;
      for (j = 0; j < c; j++)
        if (s[j] == 'R') flag[i * mx + j] = 1, cnt++;
    }
    m = cnt % n;
    a = (cnt + n - 1) / n;
    cnt = 0, n = 0;
    for (i = 0; i < r; i++) {
      if (i % 2) {
        for (j = c - 1; j >= 0; j--) {
          if (flag[i * mx + j]) cnt++;
          if (cnt == a + 1) {
            n++, cnt = 1;
            if (n == m) a--;
          }
          ans[i][j] = ckn[n];
        }
      } else {
        for (j = 0; j < c; j++) {
          if (flag[i * mx + j]) cnt++;
          if (cnt == a + 1) {
            n++, cnt = 1;
            if (n == m) a--;
          }
          ans[i][j] = ckn[n];
        }
      }
    }
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) cout << ans[i][j];
      cout << endl;
    }
  }
}
