#include <bits/stdc++.h>
using namespace std;
char A[62];
string s[1000000], s2[1000000];
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < 10; i++) A[i] = (i + '0');
  for (int i = 10; i < 36; i++) A[i] = (i - 10 + 'a');
  for (int i = 36; i < 62; i++) A[i] = (i - 36 + 'A');
  int tc;
  cin >> tc;
  while (tc--) {
    int n, m, k;
    cin >> n >> m >> k;
    int id = 0, r = 0;
    for (int i = 0; i < n; i++) {
      s2[i].resize(m, '.');
      cin >> s[i];
      for (int j = 0; j < m; j++) {
        if (s[i][j] == 'R') r++;
      }
    }
    int each = r / k, need = each;
    r %= k;
    if (r) need++, r--;
    for (int i = 0; i < n; i++) {
      if (i & 1) {
        for (int j = m - 1; j >= 0; j--) {
          s2[i][j] = A[id];
          if (s[i][j] == 'R') {
            need--;
            if (need == 0 && k != 1) {
              need = each;
              if (r) need++, r--;
              k--;
              id++;
            }
          }
        }
      } else {
        for (int j = 0; j < m; j++) {
          s2[i][j] = A[id];
          if (s[i][j] == 'R') {
            need--;
            if (need == 0 && k != 1) {
              need = each;
              if (r) need++, r--;
              k--;
              id++;
            }
          }
        }
      }
      cout << s2[i] << endl;
    }
  }
  return 0;
}
