#include <bits/stdc++.h>
using namespace std;
int n, m;
const int mn = 500;
string s[mn];
char hail(int x) {
  if (x < 10)
    return '0' + x;
  else if (x < 36)
    return 'a' + x - 10;
  else
    return 'A' + x - 36;
}
int ans[mn][mn];
bool done[62];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int r, c, k;
    scanf("%d%d%d", &r, &c, &k);
    for (int i = 0; i < r; i++) cin >> s[i];
    int tot = 0;
    for (int i = 0; i < r; i++)
      for (int j = 0; j < c; j++) tot += s[i][j] == 'R';
    int cnt = 0;
    for (int i = 0; i < r; i++) {
      if (i & 1) {
        for (int j = 0; j < c; j++) {
          ans[i][j] = cnt * k / tot;
          done[cnt * k / tot] = 1;
          cnt += s[i][j] == 'R';
          if (cnt == tot) cnt = tot - 1;
        }
      } else {
        for (int j = c - 1; j >= 0; j--) {
          ans[i][j] = cnt * k / tot;
          done[cnt * k / tot] = 1;
          cnt += s[i][j] == 'R';
          if (cnt == tot) cnt = tot - 1;
        }
      }
    }
    vector<int> v;
    for (int i = 0; i < k; i++)
      if (!done[i]) v.push_back(i);
    int cur = 0;
    for (int i = 0; i < r; i++) {
      if (i & 1) {
        for (int j = 0; j < c; j++) {
          if (cur == v.size()) continue;
          if (s[i][j] == 'R') continue;
          ans[i][j] = v[cur++];
        }
      } else {
        for (int j = c - 1; j >= 0; j--) {
          if (cur == v.size()) continue;
          if (s[i][j] == 'R') continue;
          ans[i][j] = v[cur++];
        }
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        printf("%c", hail(ans[i][j]));
      }
      printf("\n");
    }
  }
}
