#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
char w[10][30];
int main() {
  int t;
  for (int i = 'A'; i <= 'Z'; i++) {
    w[1][i - 'A'] = i;
  }
  for (int i = 'a'; i <= 'z'; i++) {
    w[2][i - 'a'] = i;
  }
  for (int i = '0'; i <= '9'; i++) {
    w[3][i - '0'] = i;
  }
  scanf("%d", &t);
  while (t--) {
    int r, c, k;
    char s[120][120];
    char q[120][120];
    scanf("%d%d%d", &r, &c, &k);
    int num = 0;
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        scanf(" %c", &s[i][j]);
        if (s[i][j] == 'R') {
          num++;
        }
      }
    }
    int x = num - num / k * k;
    int y = num / k;
    int now = 0;
    int sum = 1;
    int u = 1;
    int nowu = 0;
    for (int i = 1; i <= r; i++) {
      if (i & 1)
        for (int j = 1; j <= c; j++) {
          if (s[i][j] == 'R') now++;
          q[i][j] = w[u][nowu];
          if (sum <= x) {
            if (now >= y + 1) {
              sum++;
              now = 0;
              nowu++;
            }
          } else if (sum < k) {
            if (now >= y) {
              sum++;
              now = 0;
              nowu++;
            }
          }
          if (nowu >= 26) u++, nowu -= 26;
        }
      else {
        for (int j = c; j >= 1; j--) {
          if (s[i][j] == 'R') now++;
          q[i][j] = w[u][nowu];
          if (sum <= x) {
            if (now >= y + 1) {
              sum++;
              now = 0;
              nowu++;
            }
          } else if (sum < k) {
            if (now >= y) {
              sum++;
              now = 0;
              nowu++;
            }
          }
          if (nowu >= 26) u++, nowu -= 26;
        }
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) printf("%c", q[i][j]);
      printf("\n");
    }
  }
}
