#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int test;
  cin >> test;
  while (test--) {
    int n, m, k;
    cin >> n >> m >> k;
    vector<string> grid(n);
    int rice = 0;
    for (int i = 0; i < n; ++i) {
      cin >> grid[i];
      for (int j = 0; j < m; ++j) rice += (grid[i][j] == 'R');
    }
    vector<int> assigned(k);
    for (int i = 0; i < k; ++i) assigned[i] = rice / k;
    for (int i = 0; i < rice % k; ++i) assigned[i]++;
    int chicken = 0;
    vector<vector<int> > answer(n, vector<int>(m));
    for (int i = 0; i < n; ++i) {
      if (i % 2 == 0) {
        for (int j = 0; j < m; ++j) {
          if (assigned[chicken] == 0 && grid[i][j] == 'R') ++chicken;
          answer[i][j] = chicken;
          if (grid[i][j] == 'R') --assigned[chicken];
        }
      } else {
        for (int j = m - 1; j >= 0; --j) {
          if (assigned[chicken] == 0 && grid[i][j] == 'R') ++chicken;
          answer[i][j] = chicken;
          if (grid[i][j] == 'R') --assigned[chicken];
        }
      }
    }
    string s = "";
    for (char c = '0'; c <= '9'; ++c) s += c;
    for (char c = 'a'; c <= 'z'; ++c) s += c;
    for (char c = 'A'; c <= 'Z'; ++c) s += c;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        cout << s[answer[i][j]];
      }
      cout << "\n";
    }
  }
}
