#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
int pow(int x, int y) {
  int res = 1;
  while (y) {
    if (y & 1) res *= x;
    y >>= 1;
    x *= x;
  }
  return res;
}
struct Compare {
  constexpr bool operator()(
      pair<long long, pair<long long, long long> > const &a,
      pair<long long, pair<long long, long long> > const &b) const noexcept {
    return a.first < b.first ||
           (a.first == b.first && a.second.first > b.second.first);
  }
};
void prefix_function(string second, long long arr[]) {
  long long border = 0;
  arr[0] = 0;
  for (long long i = 1; i < second.size(); i++) {
    while (border > 0 && second[i] != second[border]) border = arr[border - 1];
    if (second[i] == second[border])
      border++;
    else
      border = 0;
    arr[i] = border;
  }
}
long long mod = 998244353;
long long add(long long a, long long b) {
  return (((a % mod) + (b % mod)) % mod);
}
long long mul(long long a, long long b) {
  return (((a % mod) * (b % mod)) % mod);
}
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = mul(res, a);
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
long long subs(long long a, long long b) {
  return (((a % mod) - (b % mod) + mod) % mod);
}
long long dv(long long a, long long b) {
  long long inv = binpow(b, mod - 2);
  return mul(a, inv);
}
long long dsu_arr[100000];
long long dsu_sz[100000];
void dsu(long long n) {
  for (long long i = 0; i <= n; i++) {
    dsu_arr[i] = i;
    dsu_sz[i] = 1;
  }
}
long long find(long long x) {
  long long root = x;
  while (root != dsu_arr[root]) {
    root = dsu_arr[root];
  }
  while (x != dsu_arr[x]) {
    dsu_arr[x] = root;
    x = dsu_arr[x];
  }
  return root;
}
long long merge(long long x, long long y) {
  long long root1 = find(x);
  long long root2 = find(y);
  if (root1 == root2) return 0ll;
  if (dsu_sz[x] > dsu_sz[y]) {
    dsu_arr[root2] = root1;
    dsu_sz[root1] += dsu_sz[root2];
  } else {
    dsu_sz[root2] += dsu_sz[root1];
    dsu_arr[root1] = root2;
  }
  return 1ll;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long test;
  cin >> test;
  while (test--) {
    long long r, c, p;
    cin >> r >> c >> p;
    char arr[r + 1][c + 1];
    vector<char> ans;
    for (char i = 'A'; i <= 'Z'; i++) {
      ans.push_back(i);
    }
    for (char i = 'a'; i <= 'z'; i++) {
      ans.push_back(i);
    }
    for (char i = '0'; i <= '9'; i++) {
      ans.push_back(i);
    }
    long long rice = 0;
    for (long long i = 0; i < r; i++) {
      for (long long j = 0; j < c; j++) {
        cin >> arr[i][j];
        if (arr[i][j] == 'R') rice++;
      }
    }
    long long baal = (rice + (p - 1)) / p;
    bool hbe = false;
    long long saal = rice / p;
    if (baal == saal) hbe = true;
    long long cnt = 0;
    vector<char> bb[r + 1];
    for (long long i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (long long j = 0; j < c; j++) {
          bb[i].push_back(ans[p - 1]);
          if (arr[i][j] == 'R') {
            rice--;
            cnt++;
            if (cnt == baal) {
              cnt = 0;
              if (p != 1) p--;
              if (!hbe) {
                long long x = (rice + (p - 1)) / p;
                if (x == saal) {
                  baal = saal;
                  hbe = true;
                }
              }
            }
          }
        }
      } else {
        for (long long j = c - 1; j >= 0; j--) {
          bb[i].push_back(ans[p - 1]);
          if (arr[i][j] == 'R') {
            rice--;
            cnt++;
            if (cnt == baal) {
              cnt = 0;
              if (p != 1) p--;
              if (!hbe) {
                long long x = (rice + (p - 1)) / p;
                if (x == saal) {
                  baal = saal;
                  hbe = true;
                }
              }
            }
          }
        }
      }
    }
    for (long long i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (long long j = 0; j < c; j++) {
          cout << bb[i][j];
        }
      } else {
        for (long long j = c - 1; j >= 0; j--) {
          cout << bb[i][j];
        }
      }
      cout << endl;
    }
  }
}
