#include <bits/stdc++.h>
using namespace std;
char s[102][102];
int T, n, m, k, c, res[102][102];
int main() {
  for (cin >> T; T--;) {
    cin >> n >> m >> k, c = 0;
    for (int i = 0; i < n; i++) scanf("%s", s[i]);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) c += s[i][j] == 'R';
    int u = c / k, r = c % k;
    for (int i = 0, id = 0, cnt = 0; i < n; i++)
      for (int j = i & 1 ? m - 1 : 0; j != (i & 1 ? -1 : m);
           j += i & 1 ? -1 : 1) {
        cnt += s[i][j] == 'R';
        if (id < r && cnt == u + 2 || id >= r && cnt == u + 1) id++, cnt = 1;
        res[i][j] = id < 10 ? id + 48 : (id < 36 ? id + 87 : id + 29);
      }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) putchar(res[i][j]);
      putchar('\n');
    }
  }
}
