#include <bits/stdc++.h>
using namespace std;
char a[63] = {'0', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
              'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
              'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B',
              'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
              'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
int T;
char s[102][102], Ans[102][102];
int m, n, k;
void work(int &X, int &Y) {
  if (X & 1) {
    Y++;
    if (Y == n + 1) Y--, X++;
    return;
  } else {
    Y--;
    if (Y == 0) Y++, X++;
    return;
  }
}
int main() {
  cin >> T;
  while (T--) {
    int sum = 0;
    scanf("%d %d %d", &m, &n, &k);
    for (int i = 1; i <= m; i++) {
      scanf("%s", s[i]);
    }
    for (int i = 1; i <= m; i++) {
      for (int j = n; j >= 1; j--) {
        sum += (s[i][j - 1] == 'R');
        s[i][j] = s[i][j - 1];
      }
    }
    int Ans1 = sum / k;
    int Ans2 = sum - Ans1 * k;
    int X, Y;
    X = 1;
    Y = 1;
    int cnt = 0;
    for (int i = 1; i <= k; i++) {
      cnt = 0;
      if (i <= Ans2) {
        while (cnt < 1 + Ans1) {
          Ans[X][Y] = a[i];
          if (s[X][Y] == 'R') cnt++;
          work(X, Y);
        }
      } else {
        while (cnt < Ans1) {
          Ans[X][Y] = a[i];
          if (s[X][Y] == 'R') cnt++;
          work(X, Y);
        }
      }
    }
    while (X < m) {
      Ans[X][Y] = a[k];
      work(X, Y);
    }
    while (((X & 1 && Y < n) || (!(X & 1) && Y > 1))) {
      Ans[X][Y] = a[k];
      work(X, Y);
    }
    Ans[X][Y] = a[k];
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) {
        printf("%c", Ans[i][j]);
      }
      puts("");
    }
  }
  return 0;
}
