#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
long long mod = 1e9 + 7;
long long powm(long long a, long long b, long long mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.first > b.first);
}
void solve() {
  int n, m, chik;
  cin >> n >> m >> chik;
  int rice = 0;
  int mat[n][m];
  memset(mat, 0, sizeof(mat));
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (m); j++) {
      char c;
      cin >> c;
      if (c == 'R') mat[i][j] = 1, rice++;
    }
  }
  int path[n][m];
  int n1 = rice % chik;
  int n0 = chik - n1;
  if (n1 + n0 != chik) {
    cout << -1 << endl;
    return;
  }
  int req = rice / chik;
  memset(path, 0, sizeof(path));
  int curr = req, ptr = 0;
  n0--;
  for (long long i = 0; i < (n); i++) {
    if (i % 2) {
      for (long long j = 0; j < (m); j++) {
        path[i][j] = ptr;
        if (mat[i][j] == 1) {
          curr--;
        }
        if (curr == 0) {
          if (n0 > 0) {
            n0--;
            curr = req;
            ptr++;
          } else if (n1) {
            n1--;
            curr = req + 1;
            ptr++;
          }
        }
      }
    } else {
      for (long long j = (m)-1; j >= 0; j--) {
        path[i][j] = ptr;
        if (mat[i][j] == 1) {
          curr--;
        }
        if (curr == 0) {
          if (n0 > 0) {
            n0--;
            curr = req;
            ptr++;
          } else if (n1) {
            n1--;
            curr = req + 1;
            ptr++;
          }
        }
      }
    }
  }
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (m); j++) {
      if (path[i][j] < 10)
        cout << path[i][j];
      else if (path[i][j] < 11 + 'z' - 'a')
        cout << (char)('a' + path[i][j] - 10);
      else
        cout << (char)('A' + path[i][j] - 36);
    }
    cout << endl;
    ;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);
  int tc = 1;
  cin >> tc;
  while (tc--) {
    solve();
  }
  return 0;
}
