#include <bits/stdc++.h>
using namespace std;
signed main() {
  vector<char> alphabet;
  for (long long i = 0; i < 10; i++) {
    alphabet.push_back(i + 48);
  }
  for (long long i = 0; i < 26; i++) {
    alphabet.push_back(65 + i);
    alphabet.push_back(97 + i);
  }
  long long t;
  cin >> t;
  while (t--) {
    long long n, m, k, rice = 0;
    cin >> n >> m >> k;
    vector<string> str(n);
    for (long long i = 0; i < n; i++) {
      cin >> str[i];
      for (long long j = 0; j < m; j++) {
        if (str[i][j] == 'R') {
          rice++;
        }
      }
    }
    for (long long i = 1; i < n; i += 2) {
      reverse(str[i].begin(), str[i].end());
    }
    long long p = 0, now = 0;
    vector<vector<char>> ans(n, vector<char>(m, 0));
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        long long need = (p < rice % k) ? rice / k + 1 : rice / k;
        if (str[i][j] == 'R') {
          ++now;
          ans[i][j] = alphabet[p];
          if (now > need) {
            ans[i][j] = alphabet[++p];
            now = 1;
          }
        } else {
          ans[i][j] = alphabet[p];
        }
      }
    }
    for (long long i = 1; i < n; i += 2) {
      reverse(ans[i].begin(), ans[i].end());
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        cout << ans[i][j];
      }
      cout << endl;
    }
  }
}
