#include <bits/stdc++.h>
using namespace std;
string A[110], ans[110];
char symb[70];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  int t, r, c;
  cin >> t;
  for (int i = 0; i < 10; i++) symb[i] = '0' + i;
  for (int i = 0; i < 26; i++) symb[i + 10] = 'a' + i;
  for (int i = 0; i < 26; i++) symb[i + 36] = 'A' + i;
  while (t--) {
    cin >> r >> c >> n;
    int inc = 1;
    int col = 0, ost1 = 0, ost2 = 0;
    for (int i = 0; i < r; i++) {
      cin >> A[i];
      ans[i] = "";
      for (auto j : A[i])
        if (j == 'R') col++;
    }
    int cur_c = 0, cur_r = 0;
    if (col < n) {
      ost1 = n - col, ost2 = col;
      char last;
      int num = 0;
      while (cur_r < r) {
        if (A[cur_r][cur_c] == '.') {
          if (ost1) {
            ans[cur_r] += symb[num];
            last = symb[num];
            ost1--;
            num++;
          } else
            ans[cur_r] += last;
        } else {
          ans[cur_r] += symb[num];
          last = symb[num];
          num++;
        }
        cur_c += inc;
        if (cur_c == c || cur_c == -1) {
          cur_c -= inc;
          cur_r++;
          inc *= -1;
        }
      }
    } else {
      ost1 = col % n, ost2 = col / n;
      if (ost1) ost2++, ost1--;
      int num = 0;
      while (cur_r < r) {
        if (A[cur_r][cur_c] == '.')
          ans[cur_r] += symb[num];
        else {
          if (ost2 == 0) {
            num++;
            ost2 = col / n;
            if (ost1) ost2++, ost1--;
          }
          ans[cur_r] += symb[num];
          ost2--;
        }
        cur_c += inc;
        if (cur_c == c || cur_c == -1) {
          cur_c -= inc;
          cur_r++;
          inc *= -1;
        }
      }
    }
    for (int i = 0; i < r; i++) {
      if (i & 1) reverse(ans[i].begin(), ans[i].end());
      cout << ans[i] << '\n';
    }
  }
}
