#include <bits/stdc++.h>
using namespace std;
using ll = long long;
string chicken =
    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
void solve() {
  int r, c, k;
  cin >> r >> c >> k;
  vector<string> farm(r);
  int rice = 0;
  for (int i = 0; i < r; i++) {
    cin >> farm[i];
    for (int j = 0; j < c; j++) rice += farm[i][j] == 'R';
  }
  int rice_per_chicken = rice / k;
  int lucky_ones = rice % k;
  int cur_chicken = 0, cur_rice = 0;
  vector<vector<char> > res(r, vector<char>(c));
  int seen_rice = 0;
  auto do_stuff = [&](int i, int j) {
    res[i][j] = chicken[cur_chicken];
    if (farm[i][j] == 'R') cur_rice++, seen_rice++;
    if ((cur_rice >= rice_per_chicken && cur_chicken >= lucky_ones) ||
        (cur_rice >= rice_per_chicken + 1)) {
      cur_rice = 0;
      if (seen_rice < rice) cur_chicken++;
    }
  };
  for (int i = 0; i < r; i++) {
    if (i % 2 == 0) {
      for (int j = 0; j < c; j++) do_stuff(i, j);
    } else {
      for (int j = c - 1; j >= 0; j--) do_stuff(i, j);
    }
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      cout << res[i][j];
    }
    cout << endl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  assert((int)chicken.size() == 62);
  int T;
  cin >> T;
  while (T--) solve();
}
