#include <bits/stdc++.h>
using namespace std;
using ll = long long;
char toChar(int x) {
  if (0 <= x && x < 26)
    return 'a' + x;
  else if (26 <= x && x < 52)
    return 'A' + x - 26;
  else
    return '0' + x - 52;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int r, c, k;
    cin >> r >> c >> k;
    string s[102];
    for (int i = 0; i < r; i++) {
      cin >> s[i];
    }
    int totrice = 0;
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        totrice += (s[i][j] == 'R');
      }
    }
    int rich_chicks = totrice % k;
    char ans[102][102];
    int chick = 0;
    int cur = 0;
    for (int i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < c; j++) {
          ans[i][j] = toChar(chick);
          cur += (s[i][j] == 'R');
          if (cur == totrice / k + (chick < rich_chicks)) {
            cur = 0;
            chick++;
            if (chick == k) chick = k - 1;
          }
        }
      } else {
        for (int j = c - 1; j >= 0; j--) {
          ans[i][j] = toChar(chick);
          cur += s[i][j] == 'R';
          if (cur == totrice / k + (chick < rich_chicks)) {
            cur = 0;
            chick++;
            if (chick == k) chick = k - 1;
          }
        }
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cout << ans[i][j];
      }
      cout << '\n';
    }
  }
  return 0;
}
