#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  cin >> t;
  while (t--) {
    int n, m, k;
    cin >> n >> m >> k;
    int i, j;
    bool arr[n][m];
    int sum = 0;
    for (i = 0; i < n; i++)
      for (j = 0; j < m; j++) {
        char c;
        cin >> c;
        if (c == 'R') {
          sum++;
          arr[i][j] = 1;
        } else
          arr[i][j] = 0;
      }
    int each = sum / k;
    int extra = sum % k;
    vector<char> out;
    int curr = 0;
    for (i = 0; i < 26; i++) out.push_back((char)(i + 'a'));
    for (i = 0; i < 26; i++) out.push_back((char)(i + 'A'));
    for (i = 0; i < 10; i++) out.push_back((char)(i + '0'));
    char ans[n][m];
    int cnt = 0;
    bool mpros = true;
    for (i = 0; i < n; i++) {
      if (mpros)
        for (j = 0; j < m; j++) {
          ans[i][j] = out[curr];
          if (arr[i][j]) cnt++;
          if (cnt == each && extra == 0) {
            cnt = 0;
            curr++;
            if (curr == k) {
              curr--;
              cnt = INT_MIN;
            }
          }
          if (cnt == each + 1) {
            cnt = 0;
            curr++;
            extra--;
            if (curr == k) {
              curr--;
              cnt = INT_MIN;
            }
          }
        }
      else
        for (j = m - 1; j >= 0; j--) {
          ans[i][j] = out[curr];
          if (arr[i][j]) cnt++;
          if (cnt == each && extra == 0) {
            cnt = 0;
            curr++;
            if (curr == k) {
              curr--;
              cnt = INT_MIN;
            }
          }
          if (cnt == each + 1) {
            cnt = 0;
            curr++;
            extra--;
            if (curr == k) {
              curr--;
              cnt = INT_MIN;
            }
          }
        }
      mpros ^= 1;
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) cout << ans[i][j];
      cout << '\n';
    }
  }
}
