#include <bits/stdc++.h>
using namespace std;
char arr[62];
void def() {
  int k = 0, l = 0;
  for (int i = 0; i < 62; i++) {
    if (i < 26)
      arr[i] = 'A' + i;
    else if (i < 52)
      arr[i] = 'a' + k++;
    else
      arr[i] = '0' + l++;
  }
}
int main() {
  def();
  int t;
  cin >> t;
  while (t--) {
    int r, c, k, i, j, ct = 0, rice, l = 0;
    cin >> r >> c >> k;
    char ch[r][c], ans[r][c];
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) {
        cin >> ch[i][j];
      }
    }
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) {
        if (ch[i][j] == 'R') ct++;
      }
    }
    rice = ct / k;
    if (ct % k != 0) rice++;
    int last = (rice * k) - ct;
    last = k - last;
    ct = 0;
    bool ck = true;
    for (i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (j = 0; j < c; j++) {
          if (ch[i][j] == 'R') ct++;
          ans[i][j] = arr[l];
          if (ct == rice && l < k - 1) {
            l++;
            ct = 0;
          }
          if (l == last && ck == true) {
            rice--;
            ck = false;
          }
        }
      } else {
        for (j = c - 1; j >= 0; j--) {
          if (ch[i][j] == 'R') ct++;
          ans[i][j] = arr[l];
          if (ct == rice && l < k - 1) {
            l++;
            ct = 0;
          }
          if (l == last && ck == true) {
            rice--;
            ck = false;
          }
        }
      }
    }
    for (i = 0; i < r; i++) {
      for (j = 0; j < c; j++) {
        cout << ans[i][j];
      }
      cout << '\n';
    }
  }
  return 0;
}
