#include <bits/stdc++.h>
using namespace std;
char change(char curranswer) {
  if (curranswer == 'z')
    curranswer = 'A';
  else if (curranswer == 'Z')
    curranswer = '0';
  else if (curranswer == '9')
    ;
  else
    curranswer++;
  return curranswer;
}
int main() {
  long long i, j, t;
  cin >> t;
  while (t--) {
    long long r, c, k;
    long long rice = 0;
    char a[100][100];
    cin >> r >> c >> k;
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) {
        cin >> a[i][j];
        if (a[i][j] == 'R') rice++;
      }
    }
    long long ans = rice / k;
    long long maxx = rice - k * ans;
    long long minn = k - maxx;
    char curranswer = 'a';
    long long currcount = 0;
    bool flag = true;
    for (i = 0; i < r; i++) {
      for (flag ? (j = 0) : (j = c - 1); flag ? (j < c) : j >= 0;
           flag ? j++ : j--) {
        bool local = false;
        if (a[i][j] == 'R') local = true;
        a[i][j] = curranswer;
        if (local) {
          currcount++;
          if (maxx > 0) {
            if (currcount == ans + 1) {
              maxx--;
              currcount = 0;
              curranswer = change(curranswer);
            }
          } else if (minn > 0) {
            if (currcount == ans) {
              minn--;
              currcount = 0;
              if (minn) curranswer = change(curranswer);
            }
          }
        }
      }
      flag = !flag;
    }
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) cout << a[i][j];
      cout << endl;
    }
  }
}
