#include <bits/stdc++.h>
using namespace std;
char he[63];
signed main() {
  long long t;
  cin >> t;
  for (long long i = 0; i <= 61; i++) {
    if (i <= 9) {
      he[i] = '0' + i;
    } else if (i <= 35) {
      he[i] = 'a' + i - 10;
    } else {
      he[i] = 'A' + i - 36;
    }
  }
  while (t--) {
    long long r, c, k, cc = 0;
    cin >> r >> c >> k;
    char ar[r][c], re[r][c];
    for (long long i = 0; i < r; i++) {
      for (long long j = 0; j < c; j++) {
        cin >> ar[i][j];
        if (ar[i][j] == 'R') cc++;
      }
    }
    long long nn = cc / k;
    long long rr = cc % k;
    long long id = 0;
    long long tt = nn;
    if (rr > 0) {
      tt++;
      rr--;
    }
    for (long long i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (long long j = 0; j < c; j++) {
          if (tt == -1) {
            id++;
            tt = nn - 1;
            if (rr > 0) {
              rr--;
              tt++;
            }
          }
          if (ar[i][j] == 'R') tt--;
          if (tt == -1)
            re[i][j] = he[id + 1];
          else
            re[i][j] = he[id];
        }
      } else {
        for (long long j = c - 1; j >= 0; j--) {
          if (tt == -1) {
            id++;
            tt = nn - 1;
            if (rr > 0) {
              rr--;
              tt++;
            }
          }
          if (ar[i][j] == 'R') tt--;
          if (tt == -1)
            re[i][j] = he[id + 1];
          else
            re[i][j] = he[id];
        }
      }
    }
    for (long long i = 0; i < r; i++) {
      for (long long j = 0; j < c; j++) {
        cout << re[i][j];
      }
      cout << endl;
    }
  }
}
