#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int te;
  cin >> te;
  while (te--) {
    long long int r, c, k, t = 0;
    cin >> r >> c >> k;
    string s[r];
    for (long long int i = 0; i <= r - 1; i++) cin >> s[i];
    int i = 0, j = 0;
    vector<vector<long long int> > ans(r, vector<long long int>(c, 0));
    vector<vector<char> > f(r, vector<char>(c));
    int cnt = 0;
    for (long long int i = 0; i <= r - 1; i++)
      for (long long int j = 0; j <= c - 1; j++)
        if (s[i][j] == 'R') t++;
    int rem = t % k, div = t / k, curr = 0;
    while (j < c) {
      if (j & 1) {
        for (long long int i = r - 1; i >= 0; i--) {
          if (s[i][j] == 'R') {
            curr++;
            ans[i][j] = cnt;
            if (cnt < rem && curr == div + 1)
              curr = 0, cnt++;
            else if (cnt >= rem && curr == div)
              curr = 0, cnt++;
            if (cnt == k) cnt--;
          } else {
            ans[i][j] = cnt;
          }
        }
      } else {
        for (long long int i = 0; i <= r - 1; i++) {
          if (s[i][j] == 'R') {
            curr++;
            ans[i][j] = cnt;
            if (cnt < rem && curr == div + 1)
              curr = 0, cnt++;
            else if (cnt >= rem && curr == div)
              curr = 0, cnt++;
            if (cnt == k) cnt--;
          } else {
            ans[i][j] = cnt;
          }
        }
      }
      j++;
    }
    for (long long int i = 0; i <= r - 1; i++)
      for (long long int j = 0; j <= c - 1; j++) {
        long long int x = ans[i][j];
        if (x > 51)
          f[i][j] = '0' + x - 52;
        else if (x > 25)
          f[i][j] = 'A' + x - 26;
        else
          f[i][j] = 'a' + x;
      }
    for (long long int i = 0; i <= r - 1; i++) {
      for (long long int j = 0; j <= c - 1; j++) cout << f[i][j];
      cout << "\n";
    }
  }
}
