#include <bits/stdc++.h>
using namespace std;
int t, i, j, z, x, k, ost, n, e, m, c[65], h;
vector<char> v;
char a[102][102], b[102][102];
int main() {
  for (char o = '0'; o <= '9'; ++o) v.push_back(o);
  for (char o = 'a'; o <= 'z'; ++o) v.push_back(o);
  for (char o = 'A'; o <= 'Z'; ++o) v.push_back(o);
  cin >> e;
  for (i = 1; i <= e; ++i) {
    cin >> n >> m >> k;
    x = 0;
    ost = 0;
    for (j = 1; j <= n; ++j)
      for (z = 1; z <= m; ++z) b[j][z] = '#';
    for (j = 1; j <= n; ++j)
      for (z = 1; z <= m; ++z) {
        cin >> a[j][z];
        if (a[j][z] == 'R') ++x;
      }
    ost = x % k;
    j = 1;
    while (j <= k) {
      if (ost) {
        ost--;
        c[j] = x / k + 1;
      } else
        c[j] = x / k;
      ++j;
    }
    j = 1;
    z = 1;
    h = 1;
    t = 1;
    while (h <= k) {
      if (c[h] == 0) ++h;
      if (h > k) break;
      b[j][z] = v[h - 1];
      if (a[j][z] == 'R') --c[h];
      if (t == 1)
        ++z;
      else if (t == 0)
        --z;
      if (t == 1 && z > m) {
        ++j;
        t = 0;
        --z;
      } else if (t == 0 && z < 1) {
        ++j;
        t = 1;
        ++z;
      }
    }
    for (j = 1; j <= n; ++j)
      for (z = 1; z <= m; ++z)
        if (b[j][z] == '#') b[j][z] = v[h - 2];
    for (j = 1; j <= n; ++j) {
      for (z = 1; z <= m; ++z) cout << b[j][z];
      cout << "\n";
    }
  }
}
