#include <bits/stdc++.h>
using namespace std;
const int N = 105;
char s[N][N], ans[N][N];
int x[N * N], y[N * N];
int main() {
  int T;
  scanf("%d", &T);
  int r, c, k, cnt, less, more;
  while (T--) {
    scanf("%d %d %d", &r, &c, &k);
    for (int i = 1; i <= r; i++) {
      scanf("%s", s[i] + 1);
    }
    cnt = 0;
    for (int i = 1, now = 0; i <= r; i++) {
      if (i & 1) {
        for (int j = 1; j <= c; j++) {
          now++;
          x[now] = i;
          y[now] = j;
          if (s[i][j] == 'R') {
            cnt++;
          }
        }
      } else {
        for (int j = c; j >= 1; j--) {
          now++;
          x[now] = i;
          y[now] = j;
          if (s[i][j] == 'R') {
            cnt++;
          }
        }
      }
    }
    more = cnt % k;
    less = k - more;
    for (int i = 1, rem, now = 0; i <= r * c; i++) {
      if (i == 1 || !rem) {
        if (more) {
          rem = cnt / k + 1;
          more--;
          now++;
        } else if (less) {
          rem = cnt / k;
          less--;
          now++;
        }
      }
      if (now <= 26) {
        ans[x[i]][y[i]] = 'A' + now - 1;
      } else if (now <= 52) {
        ans[x[i]][y[i]] = 'a' + now - 27;
      } else {
        ans[x[i]][y[i]] = '0' + now - 53;
      }
      if (s[x[i]][y[i]] == 'R') {
        rem--;
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        printf("%c", ans[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
