#include <bits/stdc++.h>
using namespace std;
string hl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int n, m, k, r = 0;
    cin >> n >> m >> k;
    int zg = k;
    vector<vector<char>> v(n, vector<char>(m));
    for (int i = (0); i < (n); i++)
      for (int j = (0); j < (m); j++) {
        cin >> v[i][j];
        if (v[i][j] == 'R') {
          r++;
        }
      }
    int feen = 0, maxi = ceil((double)r / k), coco = 0, b = r % k;
    if (!b) b--;
    for (int i = (0); i < (n); i++) {
      feen = min(feen, zg - 1);
      if (i % 2 == 0) {
        for (int j = (0); j < (m); j++) {
          feen = min(feen, zg - 1);
          if (v[i][j] != 'R') {
            v[i][j] = hl[feen];
          } else {
            v[i][j] = hl[feen];
            coco++;
            if (coco == maxi) {
              feen++;
              k -= maxi;
              b--;
              if (!b) {
                maxi--;
              }
              coco = 0;
            }
          }
        }
      } else {
        for (int j = (m - 1); j > (-1); j--) {
          feen = min(feen, zg - 1);
          if (v[i][j] != 'R') {
            v[i][j] = hl[feen];
          } else {
            v[i][j] = hl[feen];
            coco++;
            if (coco == maxi) {
              feen++;
              k -= maxi;
              b--;
              if (!b) {
                maxi--;
              }
              coco = 0;
            }
          }
        }
      }
    }
    for (int i = (0); i < (n); i++) {
      for (int j = (0); j < (m); j++) {
        cout << v[i][j];
      }
      cout << '\n';
    }
  }
}
