#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  long long t, i, r, c, k, j, n, cnt, x, y, p, q, l, flag;
  vector<string> a;
  vector<char> b;
  for (i = 48; i < 58; i++) {
    b.push_back(char(i));
  }
  for (i = 65; i < 91; i++) {
    b.push_back(char(i));
  }
  for (i = 97; i < 124; i++) {
    b.push_back(char(i));
  }
  string s;
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> r >> c >> n;
    cnt = 0;
    p = 0, q = 0, l = 0, flag = 1;
    for (j = 0; j < r; j++) {
      cin >> s;
      for (k = 0; k < c; k++) {
        if (s[k] == 'R') {
          cnt++;
        }
      }
      a.push_back(s);
    }
    if (cnt % n == 0) {
      x = cnt / n;
      y = n;
    } else {
      x = cnt / n + 1;
      y = cnt % n;
    }
    for (j = 0; j < r; j++) {
      if (j % 2 == 0) {
        for (k = 0; k < c; k++) {
          if (a[j][k] == 'R') {
            if (q == x) {
              p++;
              if (p == y && flag == 1) {
                x = x - 1;
                flag = 2;
              }
              q = 1;
              l++;
              a[j][k] = b[l];
            } else {
              q++;
              a[j][k] = b[l];
            }
          } else {
            a[j][k] = b[l];
          }
        }
      } else {
        for (k = c - 1; k >= 0; k--) {
          if (a[j][k] == 'R') {
            if (q == x) {
              p++;
              if (p == y && flag == 1) {
                x = x - 1;
                flag = 2;
              }
              q = 1;
              l++;
              a[j][k] = b[l];
            } else {
              q++;
              a[j][k] = b[l];
            }
          } else {
            a[j][k] = b[l];
          }
        }
      }
    }
    for (j = 0; j < r; j++) {
      cout << a[j] << endl;
    }
    a.clear();
  }
}
