#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  const string charset =
      "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  while (T--) {
    int r, c, k;
    cin >> r >> c >> k;
    int rice = 0;
    vector<string> a(r);
    for (int i = 0; i < r; i++) {
      cin >> a[i];
      for (int j = 0; j < c; j++) {
        rice += a[i][j] == 'R';
      }
    }
    vector<int> need(k, rice / k);
    for (int i = 0; i < rice % k; i++) {
      need[i]++;
    }
    int id = 0;
    int cur = 0;
    for (int i = 0; i < r; i++) {
      int st, ed, step;
      if (i % 2) {
        st = c - 1;
        ed = -1;
        step = -1;
      } else {
        st = 0;
        ed = c;
        step = 1;
      }
      for (int j = st; j != ed; j += step) {
        bool is_rice = a[i][j] == 'R';
        a[i][j] = charset[id];
        if (is_rice) {
          cur++;
          if (cur == need[id] && id < k - 1) {
            cur = 0;
            id++;
          }
        }
      }
    }
    for (int i = 0; i < r; i++) {
      cout << a[i] << endl;
    }
  }
  return 0;
}
