#include <bits/stdc++.h>
using namespace std;
int MAX_INT = numeric_limits<int>::max();
int MIN_INT = numeric_limits<int>::min();
long long MAX_LL = numeric_limits<long long>::max();
long long MIN_LL = numeric_limits<long long>::min();
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  int r, c, k;
  for (int h = 0; h < t; h++) {
    cin >> r >> c >> k;
    vector<vector<char>> grid(r, vector<char>(c));
    int rc = 0;
    for (int i = 0; i < r; i++)
      for (int j = 0; j < c; j++) {
        cin >> grid[i][j];
        rc += (grid[i][j] == 'R');
      }
    int rest = rc % k;
    int rpc = rc / k;
    string symbols =
        "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    int cur = 0;
    int pos = 0;
    for (int i = 0; i < r; i++) {
      for (int k = 0; k < c; k++) {
        int j = (i % 2) ? c - k - 1 : k;
        if (grid[i][j] == 'R') {
          if (cur < rpc + (rest > 0)) {
            cur++;
          } else {
            cur = 1;
            rest--;
            pos++;
          }
        }
        grid[i][j] = symbols[pos];
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) cout << grid[i][j];
      cout << '\n';
    }
  }
}
