#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '[';
  string sep;
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename T, size_t size>
ostream &operator<<(ostream &os, const array<T, size> &arr) {
  os << '{';
  string sep;
  for (const auto &x : arr) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '{' << p.first << ", " << p.second << '}';
}
template <typename T>
ostream &operator<<(ostream &os, const set<T> &s) {
  os << '{';
  string sep;
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const map<A, B> &mp) {
  os << '[';
  string sep;
  for (const auto &x : mp) os << sep << x, sep = ", ";
  return os << ']';
}
template <typename T>
ostream &operator<<(ostream &os, const multiset<T> &s) {
  os << '{';
  string sep;
  for (const auto &x : s) os << sep << x, sep = ", ";
  return os << '}';
}
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= 1000000007;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
long long fast_pow(long long a, long long b) {
  if (b == 1) return a;
  if (b == 0) return 1;
  long long x = fast_pow(a, b / 2);
  x *= x;
  if (b & 1) x *= a;
  return x;
}
void assign(vector<vector<char>> &mat, long long &x, long long &y,
            long long kitna, long long n, long long m, char toassign) {
  long long cnt = 0;
  long long nowx = 0, nowy = 0;
  for (long long i = x; i < n; i++) {
    bool c = 0;
    if (i % 2 == 0) {
      for (long long j = y; j < m; j++) {
        cnt += (mat[i][j] == 'R');
        mat[i][j] = toassign;
        if (cnt == kitna) {
          if (j + 1 == m) {
            y = m - 1;
            x = i + 1;
          } else {
            y = j + 1;
          }
          c = 1;
          break;
        } else if (j == m - 1) {
          y = m - 1;
          x = i + 1;
          break;
        }
      }
      if (c) break;
    } else {
      for (long long j = y; j >= 0; j--) {
        cnt += (mat[i][j] == 'R');
        mat[i][j] = toassign;
        if (cnt == kitna) {
          if (j - 1 < 0) {
            y = 0;
            x = i + 1;
          } else {
            y = j - 1;
          }
          c = 1;
          break;
        } else if (j == 0) {
          y = 0;
          x = i + 1;
          break;
        }
      }
      if (c) break;
    }
  }
}
void solve() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long n, m, k;
    cin >> n >> m >> k;
    vector<vector<char>> mat(n, vector<char>(m));
    long long cnt = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        cin >> mat[i][j];
        cnt += (mat[i][j] == 'R');
      }
    }
    char lastassign = 'a';
    long long withequal = cnt / k;
    long long withgreater = cnt % k;
    long long x = 0, y = 0;
    char toassign = 'a';
    for (long long i = 0; i < withgreater; i++) {
      assign(mat, x, y, withequal + 1, n, m, toassign);
      if (toassign == 'z') {
        lastassign = toassign;
        toassign = 'A';
      } else if (toassign == 'Z') {
        lastassign = toassign;
        toassign = '0';
      } else {
        lastassign = toassign;
        toassign += 1;
      }
    }
    for (long long i = 0; i < k - withgreater; i++) {
      assign(mat, x, y, withequal, n, m, toassign);
      if (toassign == 'z') {
        lastassign = toassign;
        toassign = 'A';
      } else if (toassign == 'Z') {
        lastassign = toassign;
        toassign = '0';
      } else {
        lastassign = toassign;
        toassign += 1;
      }
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        if (mat[i][j] == '.') {
          mat[i][j] = lastassign;
        }
      }
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        cout << mat[i][j];
      }
      cout << '\n';
    }
  }
}
int32_t main() {
  solve();
  return 0;
}
