#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
map<char, char> nx;
void solve() {
  long long r, c, k;
  cin >> r >> c >> k;
  vector<vector<char>> v(r, vector<char>(c));
  long long numr = 0;
  for (long long i = (long long)0; i != (long long)r; i = i + 1) {
    for (long long j = (long long)0; j != (long long)c; j = j + 1) {
      cin >> v[i][j];
      if (v[i][j] == 'R') numr++;
    }
  }
  long long a = numr / k, b = numr % k;
  long long cnt = 0;
  char cur = '0';
  for (long long i = (long long)0; i != (long long)r; i = i + 1) {
    if (i % 2 == 0) {
      for (long long j = (long long)0; j != (long long)c; j = j + 1) {
        if (v[i][j] == 'R') {
          cnt++;
          if (cnt == a + 2) {
            b--;
            cur = nx[cur];
            cnt = 1;
          } else if (cnt == a + 1) {
            if (b == 0) {
              cur = nx[cur];
              cnt = 1;
            }
          }
        }
        v[i][j] = cur;
      }
    } else {
      for (long long j = (long long)c - 1; j != (long long)-1; j = j + -1) {
        if (v[i][j] == 'R') {
          cnt++;
          if (cnt == a + 2) {
            b--;
            cur = nx[cur];
            cnt = 1;
          } else if (cnt == a + 1) {
            if (b == 0) {
              cur = nx[cur];
              cnt = 1;
            }
          }
        }
        v[i][j] = cur;
      }
    }
  }
  for (long long i = (long long)0; i != (long long)r; i = i + 1) {
    for (long long j = (long long)0; j != (long long)c; j = j + 1) {
      cout << v[i][j];
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  for (long long i = (long long)0; i != (long long)9; i = i + 1) {
    nx['0' + i] = '0' + i + 1;
  }
  nx['9'] = 'a';
  for (long long i = (long long)0; i != (long long)25; i = i + 1) {
    nx['a' + i] = 'a' + i + 1;
    nx['A' + i] = 'A' + i + 1;
  }
  nx['z'] = 'A';
  while (t--) {
    solve();
  }
}
