#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int q;
  cin >> q;
  vector<char> ch(65);
  for (long long int i = 0; i < 26; i++) ch[i] = 'a' + i;
  for (long long int i = 26; i < 52; i++) ch[i] = ('A' + i - 26);
  for (long long int i = 52; i < 62; i++) ch[i] = '0' + i - 52;
  ch[62] = ch[61];
  while (q--) {
    long long int n, m, k;
    cin >> n >> m >> k;
    vector<string> s(n);
    vector<vector<long long int>> ans(n, vector<long long int>(m));
    for (long long int i = 0; i < n; i++) cin >> s[i];
    long long int R = 0;
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < m; j++) {
        if (s[i][j] == 'R') R++;
      }
    }
    long long int rs = R / k;
    long long int c = R % k;
    long long int id = 1, cnt = 0;
    for (long long int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        for (long long int j = 0; j < m; j++) {
          ans[i][j] = id;
          if (s[i][j] == 'R') {
            cnt++;
            if (c > 0) {
              if (cnt == rs + 1) {
                cnt = 0;
                c--;
                id++;
              }
            } else {
              if (cnt == rs) {
                cnt = 0;
                id++;
              }
            }
          }
        }
      } else {
        for (long long int j = m - 1; j >= 0; j--) {
          ans[i][j] = id;
          if (s[i][j] == 'R') {
            cnt++;
            if (c > 0) {
              if (cnt == rs + 1) {
                cnt = 0;
                c--;
                id++;
              }
            } else {
              if (cnt == rs) {
                cnt = 0;
                id++;
              }
            }
          }
        }
      }
    }
    bool yes = true;
    for (long long int i = n - 1; i >= 0 && yes; i--) {
      if (i % 2 == 0) {
        for (long long int j = m - 1; j >= 0 && yes; j--) {
          if (id == ans[i][j]) {
            ans[i][j] = id - 1;
          } else {
            yes = false;
            break;
          }
        }
      } else {
        for (long long int j = 0; j < m && yes; j++) {
          if (id == ans[i][j]) {
            ans[i][j] = id - 1;
          } else {
            yes = false;
            break;
          }
        }
      }
    }
    for (long long int i = 0; i < n; i++) {
      for (long long int j = 0; j < m; j++) cout << ch[ans[i][j] - 1];
      cout << "\n";
    }
  }
}
