#include <bits/stdc++.h>
using namespace std;
char d[70];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int x = 1;
  for (char i = '0'; i <= '9'; i++) d[x++] = i;
  for (char i = 'a'; i <= 'z'; i++) d[x++] = i;
  for (char i = 'A'; i <= 'Z'; i++) d[x++] = i;
  int t;
  cin >> t;
  while (t--) {
    int r, c, k, cnt = 0, f = 1, g = 1, l = 0, br = 1;
    int ans[110][110];
    string s;
    vector<char> v;
    cin >> r >> c >> k;
    for (int i = 1; i <= r; i++) {
      cin >> s;
      if (i % 2 == 0) reverse((s).begin(), (s).end());
      for (auto j : s) v.push_back(j);
      for (auto j : s)
        if (j == 'R') cnt++;
    }
    if (cnt % k != 0) l = -1;
    for (int i = 0; i < v.size(); i++) {
      if (v[i] == 'R' and l == cnt / k) {
        l = 0, br++;
        if (cnt % k != 0) cnt--;
        if (cnt % k != 0) l = -1;
      }
      ans[g][f] = br;
      if (g % 2 == 1)
        f++;
      else
        f--;
      if (f == c + 1 and g % 2 == 1) f = c, g++;
      if (f == 0 and g % 2 == 0) f = 1, g++;
      if (v[i] == 'R') l++;
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        cout << d[ans[i][j]];
      }
      cout << "\n";
    }
  }
  return 0;
}
