#include <bits/stdc++.h>
using namespace std;
const int MAXN = 106;
char str[MAXN][MAXN];
vector<char> ch;
void init() {
  for (char i = '0'; i <= '9'; i++) ch.emplace_back(i);
  for (char i = 'A'; i <= 'Z'; i++) ch.emplace_back(i);
  for (char i = 'a'; i <= 'z'; i++) ch.emplace_back(i);
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int T;
  init();
  cin >> T;
  while (T--) {
    int r, c, k, cnt = 0;
    cin >> r >> c >> k;
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        cin >> str[i][j];
        if (str[i][j] == 'R') cnt++;
      }
    }
    int x = cnt / k, y = cnt % k, cht = 0;
    int xx = x;
    if (y) xx++, y--;
    for (int i = 1; i <= r; i++) {
      if (i & 1) {
        for (int j = 1; j <= c; j++) {
          if (str[i][j] == 'R') xx--, cnt--;
          str[i][j] = ch[cht];
          if (!cnt) {
            str[i][j] = ch[cht];
            continue;
          }
          if (!xx) {
            if (y)
              xx = x + 1, y--;
            else
              xx = x;
            cht++;
          }
        }
      } else {
        for (int j = c; j >= 1; j--) {
          if (str[i][j] == 'R') xx--, cnt--;
          str[i][j] = ch[cht];
          if (!cnt) {
            str[i][j] = ch[cht];
            continue;
          }
          if (!xx) {
            if (y)
              xx = x + 1, y--;
            else
              xx = x;
            cht++;
          }
        }
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) cout << str[i][j];
      cout << '\n';
    }
  }
  return 0;
}
