#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  vector<char> v;
  for (char i = '0'; i <= '9'; i++) {
    v.push_back(i);
  }
  for (char i = 'a'; i <= 'z'; i++) {
    v.push_back(i);
  }
  for (char i = 'A'; i <= 'Z'; i++) {
    v.push_back(i);
  }
  while (t > 0) {
    int n, m, k;
    cin >> n >> m >> k;
    char a[110][110], ans[110][110];
    int sum = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cin >> a[i][j];
        if (a[i][j] == 'R') {
          sum++;
        }
      }
    }
    int vals[110];
    for (int i = 1; i <= k; i++) {
      vals[i] = sum / k;
      if (sum % k >= i) {
        vals[i]++;
      }
    }
    for (int i = 1, pos = 1; i <= n; i++) {
      if (i % 2 != 0) {
        for (int j = 1; j <= m; j++) {
          if (vals[pos] == 0 && a[i][j] == 'R') {
            pos++;
          }
          if (a[i][j] == 'R') {
            vals[pos]--;
          }
          ans[i][j] = v[pos - 1];
        }
      } else {
        for (int j = m; j >= 1; j--) {
          if (vals[pos] == 0 && a[i][j] == 'R') {
            pos++;
          }
          if (a[i][j] == 'R') {
            vals[pos]--;
          }
          ans[i][j] = v[pos - 1];
        }
      }
    }
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        cout << ans[i][j];
      }
      cout << endl;
    }
    t--;
  }
}
