#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    int n, m, k, cnt = 0;
    cin >> n >> m >> k;
    vector<string> v(n);
    for (int i = 0; i < n; i++) {
      cin >> v[i];
      if (i % 2) reverse((v[i]).begin(), (v[i]).end());
      for (auto x : v[i]) {
        if (x == 'R') cnt++;
      }
    }
    vector<char> label;
    for (char ch = 'a'; ch <= 'z'; ch++) label.push_back(ch);
    for (char ch = 'A'; ch <= 'Z'; ch++) label.push_back(ch);
    for (char ch = '0'; ch <= '9'; ch++) label.push_back(ch);
    int chick = 0;
    int each = (cnt - 1) / k + 1;
    int num2 = (k - cnt % k) % k;
    int num1 = k - num2;
    int lim = 0;
    vector<vector<char>> ans(n, vector<char>(m));
    int x = n, y = m;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (v[i][j] == 'R') lim++;
        if (lim > each) {
          lim = 1;
          chick++;
          num1--;
        }
        if (num1 == 0) {
          x = i;
          y = j;
          break;
        }
        ans[i][j] = label[chick];
      }
      if (num1 == 0) break;
    }
    each--;
    lim = 0;
    for (int i = x; i < n; i++) {
      for (int j = y; j < m; j++) {
        if (v[i][j] == 'R') lim++;
        if (lim > each) {
          lim = 1;
          chick++;
        }
        ans[i][j] = label[chick];
      }
      y = 0;
    }
    for (int i = 0; i < n; i++) {
      if (i % 2) {
        for (int j = m - 1; j >= 0; j--) cout << ans[i][j];
      } else {
        for (int j = 0; j < m; j++) cout << ans[i][j];
      }
      cout << endl;
    }
  }
  return 0;
}
