#include <bits/stdc++.h>
using namespace std;
string rs = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
int main() {
  ios_base::sync_with_stdio(false);
  int t, i, j, cnt;
  int r, c, n, k, rem;
  cin >> t;
  while (t--) {
    cin >> r >> c >> k;
    string s[105];
    char ss[105][105];
    cnt = 0;
    for (i = 0; i < r; i++) {
      cin >> s[i];
      for (auto sx : s[i])
        if (sx == 'R') cnt++;
    }
    n = cnt / k;
    rem = cnt % k;
    int x, y, dx, dy, p, ck;
    x = 0, y = 0, dy = 1, p = 0, ck = 0;
    while (x < r) {
      if (s[x][y] == 'R') ck++;
      if (ck > n && !rem)
        ck = 1, ss[x][y] = rs[++p];
      else if (ck > n && rem)
        ss[x][y] = rs[p], p++, ck = 0, rem--;
      else
        ss[x][y] = rs[p];
      if (y == c - 1 && dy == 1)
        x++, dy = -1;
      else if (y == 0 && dy == -1)
        x++, dy = 1;
      else
        y += dy;
    }
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) cout << ss[i][j];
      cout << endl;
    }
  }
  return 0;
}
