#include <bits/stdc++.h>
using namespace std;
const long long N = 105, M = 1e9 + 7;
long long t, n, m, r, c, k, v[N];
char mp[N], a[N][N];
void pre() {
  for (int i = 0; i < 26; i++) {
    mp[i] = 'a' + i;
  }
  for (int i = 26; i < 52; i++) {
    mp[i] = 'A' + (i - 26);
  }
  for (int i = 52; i < 62; i++) {
    mp[i] = '0' + i - (52);
  }
  mp[63] = 9;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  pre();
  cin >> t;
  while (t--) {
    int cnt = 0;
    cin >> r >> c >> k;
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cin >> a[i][j];
        if (a[i][j] != '.') {
          cnt++;
        }
      }
    }
    for (int i = 0; i < k; i++) {
      v[i] = cnt / k;
    }
    for (int i = 0; i < cnt % k; i++) {
      v[i]++;
    }
    int idx = 0;
    for (int i = 0; i < r; i++) {
      vector<char> vec;
      for (int j = 0; j < c; j++) {
        int jj = (i % 2 == 0 ? j : c - 1 - j);
        while (idx < k - 1 && !v[idx]) {
          idx++;
        }
        vec.push_back(mp[idx]);
        v[idx] -= (a[i][jj] != '.');
      }
      if (i % 2 == 1) {
        reverse(vec.begin(), vec.end());
      }
      for (auto cc : vec) {
        cout << cc;
      }
      cout << "\n";
    }
  }
}
