#include <bits/stdc++.h>
using namespace std;
const int imax = 1e9 + 7;
const long long lmax = 1e18;
vector<char> ch;
int calc() {
  vector<string> s;
  vector<pair<int, int> > v;
  int i, j, r, C, k, n, ex, pi, pj;
  cin >> r >> C >> k;
  s.clear();
  s.resize(r);
  v.clear();
  string t;
  for (i = 0; i < r; ++i) {
    cin >> t;
    s[i] = t;
    if (i % 2 == 0) {
      for (j = 0; j < ((int)s[i].size()); ++j)
        if (s[i][j] == 'R') v.push_back({i, j});
    } else {
      for (j = ((int)s[i].size()) - 1; j >= 0; --j)
        if (s[i][j] == 'R') v.push_back({i, j});
    }
  }
  n = v.size() / k;
  ex = v.size() % k;
  reverse(v.begin(), v.end());
  for (i = 0; i < k; ++i) {
    for (j = 0; j < n; ++j) {
      pi = v.back().first;
      pj = v.back().second;
      v.pop_back();
      s[pi][pj] = ch[i];
    }
    if (ex) {
      ex--;
      pi = v.back().first;
      pj = v.back().second;
      v.pop_back();
      s[pi][pj] = ch[i];
    }
  }
  char c = '0';
  for (i = 0; i < r; ++i) {
    if (i % 2 == 0) {
      for (j = 0; j < ((int)s[i].size()); ++j)
        if (s[i][j] == '.')
          s[i][j] = c;
        else
          c = s[i][j];
    } else {
      for (j = ((int)s[i].size()) - 1; j >= 0; --j)
        if (s[i][j] == '.')
          s[i][j] = c;
        else
          c = s[i][j];
    }
  }
  for (i = 0; i < r; ++i) cout << s[i] << endl;
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ch.clear();
  int i;
  for (i = '0'; i < '9' + 1; ++i) ch.push_back(i);
  for (i = 'a'; i < 'z' + 1; ++i) ch.push_back(i);
  for (i = 'A'; i < 'Z' + 1; ++i) ch.push_back(i);
  int t;
  cin >> t;
  while (t--) calc();
  return 0;
}
