#include <bits/stdc++.h>
using namespace std;
const int MAX = 109;
char ch[MAX][MAX], res[MAX][MAX];
char out[63];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int cnt = 0;
  for (char i = 'a'; i <= 'z'; i++) out[cnt++] = i;
  for (char i = 'A'; i <= 'Z'; i++) out[cnt++] = i;
  for (char i = '0'; i <= '9'; i++) out[cnt++] = i;
  int t;
  cin >> t;
  while (t--) {
    int n, m, c, r = 0;
    cin >> n >> m >> c;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++) {
        cin >> ch[i][j];
        if (ch[i][j] == 'R') r++;
      }
    int u = r / c, v = r % c, tmp = 0, ans = 0, realans = 0;
    int x = 0, y = 0, dir = 1;
    for (int i = 0; i < n * m; i++) {
      if ((v && tmp == u + 1) || (!v && tmp == u)) {
        tmp = 0, ans++;
        if (v) v--;
      }
      if (ch[x][y] == 'R') realans = ans, tmp++;
      res[x][y] = out[realans];
      y += dir;
      if ((dir == +1 && y == m) || (dir == -1 && y == -1)) {
        y -= dir;
        dir *= -1;
        x++;
      }
    }
    for (int i = 0; i < n; i++, cout << '\n')
      for (int j = 0; j < m; j++) cout << res[i][j];
  }
  return 0;
}
