#include <bits/stdc++.h>
using namespace std;
int t, r, c, k, rice, a, b;
char chicken[65], farm[105][105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int id = 0;
  for (char ch = 'a'; ch <= 'z'; ch++) {
    chicken[id++] = ch;
  }
  for (char ch = 'A'; ch <= 'Z'; ch++) {
    chicken[id++] = ch;
  }
  for (char ch = '0'; ch <= '9'; ch++) {
    chicken[id++] = ch;
  }
  cin >> t;
  while (t--) {
    cin >> r >> c >> k;
    rice = 0;
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cin >> farm[i][j];
        rice += (farm[i][j] == 'R');
      }
    }
    a = rice / k;
    b = rice % k;
    id = 0;
    int cur = 0;
    for (int i = 0; i < r; i++) {
      int j;
      if (i & 1) {
        j = c - 1;
      } else {
        j = 0;
      }
      while (j >= 0 && j < c) {
        if (farm[i][j] == 'R') {
          cur++;
        }
        farm[i][j] = chicken[id];
        if (cur == a + (b > 0)) {
          cur = 0;
          b--;
          if (id < k - 1) {
            id++;
          }
        }
        if (i & 1) {
          j--;
        } else {
          j++;
        }
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cout << farm[i][j];
      }
      cout << '\n';
    }
  }
  return 0;
}
