#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
string s[101];
char a[101][101];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m, k;
    int now = 0;
    int all = 0;
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (s[i][j] == 'R') all++;
      }
    }
    int w = all / k, tt = all % k;
    int c = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < m; j++) {
          if (now == k) now--;
          if (now >= 0 && now <= 9) {
            a[i][j] = now + '0';
          } else if (now > 9 && now < 36) {
            a[i][j] = (now - 10) + 'a';
          } else {
            a[i][j] = (now - 36) + 'A';
          }
          c += s[i][j] == 'R';
          if (tt) {
            if (c == w + 1) {
              c = 0;
              tt--;
              now++;
            }
          } else {
            if (c == w) {
              c = 0;
              now++;
            }
          }
        }
      } else {
        for (int j = m - 1; j >= 0; j--) {
          if (now == k) now--;
          if (now >= 0 && now <= 9) {
            a[i][j] = now + '0';
          } else if (now > 9 && now < 36) {
            a[i][j] = (now - 10) + 'a';
          } else {
            a[i][j] = (now - 36) + 'A';
          }
          c += s[i][j] == 'R';
          if (tt) {
            if (c == w + 1) {
              c = 0;
              tt--;
              now++;
            }
          } else {
            if (c == w) {
              c = 0;
              now++;
            }
          }
        }
      }
      if (now == k) now--;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        printf("%c", a[i][j]);
      }
      printf("\n");
    }
  }
}
