#include <bits/stdc++.h>
using namespace std;
void solve() {
  int r, c, k;
  cin >> r >> c >> k;
  vector<string> a(r);
  int rice = 0;
  for (auto &x : a) {
    cin >> x;
    for (auto cc : x)
      if (cc == 'R') rice++;
  }
  int chicken = 0;
  char chicken_char = '0';
  int chicken_rice = 0;
  for (int i = 0; i < r; ++i)
    for (int j = 0; j < c; ++j) {
      int col = i % 2 ? c - j - 1 : j;
      if (a[i][col] == 'R') {
        chicken_rice++;
        a[i][col] = chicken_char;
        int needed = rice / k;
        if (chicken < rice % k) needed++;
        if (chicken_rice == needed && chicken < k - 1) {
          chicken++;
          chicken_rice = 0;
          chicken_char++;
          if (chicken_char == '9' + 1) chicken_char = 'A';
          if (chicken_char == 'Z' + 1) chicken_char = 'a';
        }
      } else {
        a[i][col] = chicken_char;
      }
    }
  for (auto &s : a) cout << s << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
