#include <bits/stdc++.h>
using namespace std;
int T, r, c, k, d;
char C, chicken[65];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> T;
  d = 0;
  for (char c = 'a'; c <= 'z'; c++) chicken[++d] = c;
  for (char c = 'A'; c <= 'Z'; c++) chicken[++d] = c;
  for (char c = '0'; c <= '9'; c++) chicken[++d] = c;
  for (int p = 1; p <= T; p++) {
    d = 0;
    cin >> r >> c >> k;
    char kq[r + 1][c + 1], A[r + 1][c + 1];
    for (int i = 1; i <= r; i++)
      for (int j = 1; j <= c; j++) {
        cin >> A[i][j];
        if (A[i][j] == 'R') d++;
      }
    int i = 1, j = 1, cnt = 0, dem = 1;
    while (i <= r) {
      if (A[i][j] == 'R') cnt++;
      if (dem <= d % k && cnt == d / k + 2) {
        cnt = 1;
        dem++;
      }
      if (dem > d % k && cnt == d / k + 1) {
        cnt = 1;
        dem++;
      }
      kq[i][j] = chicken[dem];
      if (i % 2) {
        j++;
        if (j == c + 1) {
          i++;
          j = c;
        }
      } else {
        j--;
        if (j == 0) {
          i++;
          j = 1;
        }
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) cout << kq[i][j];
      cout << endl;
    }
  }
}
