#include <bits/stdc++.h>
using namespace std;
char qu(int x) {
  if (x <= 10)
    return char(x - 1 + '0');
  else if (x <= 36)
    return char(x - 11 + 'a');
  else
    return char(x - 37 + 'A');
}
int n, m, k;
char a[109][109], ans[109][109];
void print() {
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cout << ans[i][j];
    cout << endl;
  }
}
void solve() {
  int now = 1;
  for (int i = 1; i <= n; i++) {
    if (i % 2 == 1) {
      for (int j = 1; j <= m; j++) {
        ans[i][j] = qu(now);
        if (now < k) now++;
      }
    } else {
      for (int j = m; j >= 1; j--) {
        ans[i][j] = qu(now);
        if (now < k) now++;
      }
    }
  }
  print();
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    int R = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        cin >> a[i][j];
        if (a[i][j] == 'R') R++;
      }
    int q = R / k, now = 1, temp = 0, zz = R % k;
    if (R == 0 || (q == 0 && zz == 0)) {
      solve();
      continue;
    }
    for (int i = 1; i <= n; i++) {
      if (i % 2 == 1) {
        for (int j = 1; j <= m; j++) {
          ans[i][j] = qu(now);
          if (a[i][j] == 'R') temp++, R--;
          if (R == 0) continue;
          if (temp == q && now <= (k - zz))
            temp = 0, now++;
          else if (temp == q + 1 && now > (k - zz))
            temp = 0, now++;
        }
      } else {
        for (int j = m; j >= 1; j--) {
          ans[i][j] = qu(now);
          if (a[i][j] == 'R') temp++, R--;
          if (R == 0) continue;
          if (temp == q && now <= (k - zz))
            temp = 0, now++;
          else if (temp == q + 1 && now > (k - zz))
            temp = 0, now++;
        }
      }
    }
    print();
  }
}
