#include <bits/stdc++.h>
using namespace std;
ostream &operator<<(ostream &out, string str) {
  for (char c : str) out << c;
  return out;
}
template <class L, class R>
ostream &operator<<(ostream &out, pair<L, R> p) {
  return out << "(" << p.first << ", " << p.second << ")";
}
template <class T>
auto operator<<(ostream &out, T a) -> decltype(a.begin(), out) {
  out << "{";
  for (auto it = a.begin(); it != a.end(); it = next(it))
    out << (it != a.begin() ? ", " : "") << *it;
  return out << "}";
}
void dump() { cerr << "\n"; }
template <class T, class... Ts>
void dump(T a, Ts... x) {
  cerr << a << ", ";
  dump(x...);
}
template <class T>
int size(T &&a) {
  return a.size();
}
using LL = long long;
using PII = pair<int, int>;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int it = 0; it < t; it++) {
    int r, c, k;
    cin >> r >> c >> k;
    vector<vector<char>> a(r, vector<char>(c));
    int cnt = 0;
    for (int i = 0; i < r; i++)
      for (int j = 0; j < c; j++) {
        cin >> a[i][j];
        if (a[i][j] == 'R') cnt++;
      }
    auto get = [&](int id) {
      int alf = 'Z' - 'A' + 1;
      if (id < alf) return 'a' + id;
      id -= alf;
      if (id < alf) return 'A' + id;
      id -= alf;
      return '0' + id;
    };
    vector<PII> path;
    for (int i = 0; i < r; i++)
      for (int j = 0; j < c; j++) {
        if (i % 2 == 0)
          path.emplace_back(i, j);
        else
          path.emplace_back(i, c - 1 - j);
      }
    vector<vector<char>> out(r, vector<char>(c, get(k - 1)));
    int pos = 0;
    for (int i = 0; i < k; i++) {
      int q = cnt / k + (i < cnt % k);
      while (q) {
        int x, y;
        tie(x, y) = path[pos++];
        out[x][y] = get(i);
        q -= a[x][y] == 'R';
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) cout << out[i][j];
      cout << "\n";
    }
  }
}
