#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  string sym = "0123456789qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";
  for (int tt = 0; tt < t; tt++) {
    int n, m, k;
    cin >> n >> m >> k;
    int r = 0;
    vector<vector<char>> mat(n, vector<char>(m));
    vector<vector<bool>> f(n, vector<bool>(m, false));
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) {
        char buf;
        cin >> buf;
        if (buf == 'R') {
          f[i][j] = true;
          r++;
        }
      }
    int pos = 0;
    int cnt_chicken1, cnt_chicken2, rise;
    cnt_chicken2 = r % k;
    cnt_chicken1 = k - cnt_chicken2;
    rise = r / k;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < m; j++) {
          mat[i][j] = sym[pos];
          if (f[i][j]) cnt++;
          if (cnt == rise) {
            cnt = 0;
            cnt_chicken1--;
            if (cnt_chicken1 || cnt_chicken2) pos++;
          }
          if (cnt_chicken1 == 0) {
            cnt_chicken1 = cnt_chicken2;
            rise++;
            cnt_chicken2 = 0;
          }
        }
      } else {
        for (int j = m - 1; j >= 0; j--) {
          mat[i][j] = sym[pos];
          if (f[i][j]) cnt++;
          if (cnt == rise) {
            cnt = 0;
            cnt_chicken1--;
            if (cnt_chicken1 || cnt_chicken2) pos++;
          }
          if (cnt_chicken1 == 0) {
            cnt_chicken1 = cnt_chicken2;
            cnt_chicken2 = 0;
            rise++;
          }
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) cout << mat[i][j];
      cout << '\n';
    }
  }
}
