#include <bits/stdc++.h>
using namespace std;
const long double pi = 2 * acos(0.0);
long long infinity = std::numeric_limits<long long>::max();
long long binary_search(long long dp[], long long n, long long p) {
  long long l, r, mid;
  l = 0;
  r = n - 1;
  sort(dp, dp + n);
  while (l <= r && l >= 0 && l <= n - 1 && r >= 0 && r <= n - 1) {
    mid = (l + r) / 2;
    if (dp[mid] >= p) {
      r = mid - 1;
    } else {
      l = mid + 1;
    }
  }
  return l;
}
struct order {
  long long l, r;
};
bool compare(order o1, order o2) {
  if (o1.l == o2.l)
    return (o1.r < o2.r);
  else
    return (o1.l < o2.l);
}
bool check(order o1, order o2) { return (o1.r < o2.l); }
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long r, c, k, num_R = 0, i, j;
    cin >> r >> c >> k;
    char A[r][c];
    for (i = 0; i < r; ++i)
      for (j = 0; j < c; ++j) {
        cin >> A[i][j];
        num_R += (A[i][j] == 'R');
      }
    long long x = ceil((double)num_R / (double)k), a, b, c1 = 0, x_count = 0,
              y_count = 0;
    char req = 48;
    b = x * k - num_R;
    a = k - b;
    long long a1 = a, b1 = b, l = 0, f = 0;
    for (i = 0; i < r; ++i) {
      if (i % 2 == 0)
        j = 0;
      else
        j = c - 1;
      while ((i % 2 == 0 && j < c) || (i % 2 == 1 && j >= 0)) {
        if (A[i][j] != 'R')
          A[i][j] = req;
        else {
          A[i][j] = req;
          ++c1;
          if (c1 == x * a) {
            c1 = 0;
            x = x - 1;
            a = b;
            if (l == 1 || a == 0) {
              f = 1;
              break;
            }
            if (a != 0) ++req;
            ++l;
          } else if (c1 % x == 0) {
            ++req;
          }
        }
        if (i % 2 == 0)
          ++j;
        else
          --j;
        if (req == 58)
          req = 65;
        else if (req == 91)
          req = 97;
      }
      if (f == 1) {
        break;
      }
    }
    for (i = 0; i < r; ++i) {
      for (j = 0; j < c; ++j) {
        if (A[i][j] != '.')
          cout << A[i][j];
        else
          cout << req;
      }
      cout << "\n";
    }
  }
  return 0;
}
