#include <bits/stdc++.h>
using namespace std;
vector<char> v;
char c[105][105];
stack<char> stk;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i <= 9; i++) v.push_back('0' + i);
  for (int i = 0; i < 26; i++) v.push_back('a' + i);
  for (int i = 0; i < 26; i++) v.push_back('A' + i);
  int T;
  cin >> T;
  while (T--) {
    int R, C, k;
    int num = 0;
    cin >> R >> C >> k;
    for (int i = 0; i < R; i++) {
      for (int j = 0; j < C; j++) {
        cin >> c[i][j];
        if (c[i][j] == 'R') {
          num++;
        }
      }
    }
    int z = 0;
    if (num % k != 0) z = num % k;
    int gol = num / k + 1;
    int now = 0;
    int sum = 0;
    if (z == 0) gol--;
    for (int i = 0; i < R; i++) {
      if (i % 2 == 0)
        for (int j = 0; j < C; j++) {
          cout << v[now];
          if (c[i][j] == 'R') {
            sum++;
            if (sum == gol && now != k - 1) {
              now++;
              sum = 0;
              if (now == z) gol--;
            }
          }
        }
      else {
        for (int j = C - 1; j >= 0; j--) {
          stk.push(v[now]);
          if (c[i][j] == 'R') {
            sum++;
            if (sum == gol && now != k - 1) {
              now++;
              sum = 0;
              if (now == z) gol--;
            }
          }
        }
        while (!stk.empty()) {
          cout << stk.top();
          stk.pop();
        }
      }
      cout << endl;
    }
  }
}
