#include <bits/stdc++.h>
using namespace std;
char Array[105][105], Str[105], Ans[105][105];
void Assign(int Cur, int row, int column, int k) {
  if (Cur >= k) --Cur;
  if (Cur <= 9)
    Ans[row][column] = '0' + Cur;
  else if (Cur <= 35)
    Ans[row][column] = 'a' + (Cur - 10);
  else
    Ans[row][column] = 'A' + (Cur - 36);
}
void FindAns(int r, int c, int k, int Sum) {
  int each = Sum / k, rem = Sum % k;
  int Count = 0, i, j, Cur = 0, extra = 0;
  for (i = 1; i <= r; ++i) {
    if (i & 1) {
      for (j = 1; j <= c; ++j) {
        Assign(Cur, i, j, k);
        if (Array[i][j] == 'R') {
          ++Count;
          if (Count == each) {
            if (extra < rem)
              continue;
            else {
              ++Cur;
              Count = 0;
            }
          } else if (Count == each + 1) {
            ++Cur;
            Count = 0;
            ++extra;
          }
        }
      }
    } else {
      for (j = c; j >= 1; --j) {
        Assign(Cur, i, j, k);
        if (Array[i][j] == 'R') {
          ++Count;
          if (Count == each) {
            if (extra < rem)
              continue;
            else {
              ++Cur;
              Count = 0;
            }
          } else if (Count == each + 1) {
            ++Cur;
            Count = 0;
            ++extra;
          }
        }
      }
    }
  }
}
int main() {
  int T, r, c, k, i, j, Sum;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d", &r, &c, &k);
    Sum = 0;
    for (i = 1; i <= r; ++i) {
      scanf("%s", Str);
      for (j = 0; j < c; ++j) {
        Array[i][j + 1] = Str[j];
        if (Str[j] == 'R') ++Sum;
      }
    }
    FindAns(r, c, k, Sum);
    for (i = 1; i <= r; ++i) {
      for (j = 1; j <= c; ++j) printf("%c", Ans[i][j]);
      puts("");
    }
  }
  return 0;
}
