#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 10;
char g[maxn][maxn];
int ans[maxn][maxn];
vector<char> sig;
int main() {
  int t;
  scanf("%d", &t);
  for (char i = '0'; i <= '9'; i++) sig.push_back(i);
  for (char i = 'A'; i <= 'Z'; i++) sig.push_back(i);
  for (char i = 'a'; i <= 'z'; i++) sig.push_back(i);
  while (t--) {
    int n, m, k, rice = 0;
    scanf("%d%d%d", &n, &m, &k);
    for (int i = 0; i < n; i++) scanf("%s", g[i]);
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++)
        if (g[i][j] == 'R') rice++;
    }
    vector<int> v;
    v.clear();
    int p = rice % k;
    for (int i = 0; i < k; i++) {
      v.push_back(rice / k + (p > 0 ? 1 : 0));
      p--;
    }
    int q = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) {
        int j1;
        if (i % 2)
          j1 = m - j - 1;
        else
          j1 = j;
        ans[i][j1] = q;
        if (g[i][j1] == 'R') v[q]--;
        if (!v[q] && q + 1 < k) q++;
      }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        putchar(sig[ans[i][j]]);
      }
      putchar('\n');
    }
  }
  return 0;
}
