#include <bits/stdc++.h>
using namespace std;
const int N = 1e2 + 10;
char mat[N][N];
int ans[N][N];
char cor[N];
int d, rest;
void check(int &ccor, int &curqnt, int &targ) {
  if (curqnt == targ) {
    ccor++;
    curqnt = 0;
    targ = d;
    if (rest) {
      targ++;
      rest--;
    }
  }
}
int main() {
  int T;
  cin >> T;
  int cnt = 0;
  for (char c = '0'; c <= '9'; c++) {
    cor[cnt++] = c;
  }
  for (char c = 'a'; c <= 'z'; c++) {
    cor[cnt++] = c;
  }
  for (char c = 'A'; c <= 'Z'; c++) {
    cor[cnt++] = c;
  }
  for (int tt = 0; tt < T; tt++) {
    int r, c, nc;
    cin >> r >> c >> nc;
    int nr = 0;
    for (int i = 0; i < r; i++)
      for (int j = 0; j < c; j++) {
        scanf(" %c", mat[i] + j);
        if (mat[i][j] == 'R') nr++;
      }
    rest = nr % nc;
    d = nr / nc;
    int cur = 0;
    int targ = 0;
    int ccor = -1;
    check(ccor, cur, targ);
    for (int i = 0; i < r; i++) {
      if (i % 2) {
        for (int j = 0; j < c; j++) {
          ans[i][j] = ccor;
          if (mat[i][j] == 'R') cur++;
          check(ccor, cur, targ);
        }
      } else {
        for (int j = c - 1; j >= 0; j--) {
          ans[i][j] = ccor;
          if (mat[i][j] == 'R') cur++;
          check(ccor, cur, targ);
        }
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        if (ans[i][j] == nc) ans[i][j]--;
        printf("%c", cor[ans[i][j]]);
      }
      puts("");
    }
  }
}
