#include <bits/stdc++.h>
using namespace std;
string ss = "";
int cnt[80];
void solve() {
  int r, c, k, rc = 0;
  cin >> r >> c >> k;
  string s[r + 2];
  for (int i = 0; i < r; i++) {
    cin >> s[i];
    for (auto ch : s[i]) {
      if (ch == 'R') rc++;
    }
  }
  int al = rc / k;
  int ex = rc % k;
  for (int i = 0; i < k; i++) cnt[i] = al;
  for (int i = 0; i < ex; i++) cnt[i]++;
  vector<pair<int, int> > cell;
  for (int i = 0; i < r; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < c; j++) {
        cell.push_back(make_pair(i, j));
      }
    } else {
      for (int j = c - 1; j >= 0; j--) {
        cell.push_back(make_pair(i, j));
      }
    }
  }
  int nw = 0;
  for (auto p = cell.begin(); p != cell.end(); p++) {
    pair<int, int> tmp = *p;
    int x = tmp.first;
    int y = tmp.second;
    if (s[x][y] == 'R') {
      if (cnt[nw] <= 0) {
        nw++;
        p--;
        continue;
      } else {
        cnt[nw]--;
        s[x][y] = ss[nw];
      }
    } else {
      s[x][y] = ss[nw];
    }
  }
  for (int i = 0; i < r; i++) {
    cout << s[i] << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (char ch = '0'; ch <= '9'; ch++) {
    ss += ch;
  }
  for (char ch = 'A'; ch <= 'Z'; ch++) {
    ss += ch;
  }
  for (char ch = 'a'; ch <= 'z'; ch++) {
    ss += ch;
  }
  while (t--) {
    memset(cnt, 0, sizeof cnt);
    solve();
  }
  return 0;
}
