#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    int r, c, k;
    cin >> r >> c >> k;
    string s[r];
    for (int i = 0; i < r; ++i) cin >> s[i];
    int su = 0;
    for (int i = 0; i < r; ++i)
      for (int j = 0; j < c; ++j)
        if (s[i][j] == 'R') ++su;
    string ans[r];
    for (int i = 0; i < r; ++i) ans[i] = s[i];
    vector<int> ch;
    for (int i = 'A'; i <= 'Z'; ++i) ch.push_back(i);
    for (int i = 'a'; i <= 'z'; ++i) ch.push_back(i);
    for (int i = '0'; i <= '9'; ++i) ch.push_back(i);
    vector<int> le;
    int lef = su % k;
    for (int i = 0; i < k; ++i) {
      int er = su / k;
      if (lef != 0) {
        lef--;
        er++;
      }
      le.push_back(er);
    }
    int x = 0, y = 0, l = 1;
    int cc = 0, i = 0;
    while (1) {
      if (s[x][y] == 'R') ++cc;
      ans[x][y] = ch[i];
      if (cc == le[i] && i < k - 1) {
        cc = 0;
        ++i;
      }
      if (y == c - 1 && x % 2 == 0) {
        x++;
        l = -1;
      } else if (y == 0 && x % 2 == 1) {
        x++;
        l = 1;
      } else
        y += l;
      if (x == r) break;
    }
    for (int i = 0; i < r; ++i) cout << ans[i] << "\n";
  }
}
