#include <bits/stdc++.h>
using namespace std;
double PI = 3.1415926535897932384626;
long long t;
vector<char> chickens;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  for (char a = 'a'; a <= 'z'; a++) chickens.emplace_back(a);
  for (char a = 'A'; a <= 'Z'; a++) chickens.emplace_back(a);
  for (char a = '0'; a <= '9'; a++) chickens.emplace_back(a);
  cin >> t;
  while (t--) {
    long long r, c, k;
    char grid[110][110];
    cin >> r >> c >> k;
    long long ccount = 0;
    for (long long i = 1; i <= r; i++) {
      for (long long j = 1; j <= c; j++) {
        cin >> grid[i][j];
        if (grid[i][j] == 'R') {
          ccount++;
          grid[i][j] = '#';
        }
      }
    }
    long long di = ccount / k;
    long long rem = ccount % k;
    long long rem1 = k - (ccount % k);
    long long xx = 1, yy = 1;
    long long pos = 0;
    long long fl = 0;
    while (rem--) {
      long long hehe = di + 1;
      while (hehe > 0) {
        if (grid[xx][yy] == '#') hehe--;
        grid[xx][yy] = chickens[pos];
        if (fl == 0)
          yy++;
        else
          yy--;
        if (yy == (c + 1)) {
          yy = c;
          xx++;
          fl ^= 1;
        }
        if (yy == (0)) {
          yy = 1;
          xx++;
          fl ^= 1;
        }
      }
      if (xx == (r + 1)) break;
      pos++;
    }
    while (rem1--) {
      long long hehe = di;
      while (hehe > 0) {
        if (grid[xx][yy] == '#') hehe--;
        grid[xx][yy] = chickens[pos];
        if (fl == 0)
          yy++;
        else
          yy--;
        if (yy == (c + 1)) {
          yy = c;
          xx++;
          fl ^= 1;
        }
        if (yy == (0)) {
          yy = 1;
          xx++;
          fl ^= 1;
        }
      }
      if (xx == (r + 1)) break;
      pos++;
    }
    pos--;
    while (xx != (r + 1)) {
      grid[xx][yy] = chickens[pos];
      if (fl == 0)
        yy++;
      else
        yy--;
      if (yy == (c + 1)) {
        yy = c;
        xx++;
        fl ^= 1;
      }
      if (yy == (0)) {
        yy = 1;
        xx++;
        fl ^= 1;
      }
    }
    for (long long i = 1; i <= r; i++) {
      for (long long j = 1; j <= c; j++) {
        cout << grid[i][j];
      }
      cout << "\n";
    }
  }
  return 0;
}
