#include <bits/stdc++.h>
using namespace std;
unsigned long long min(unsigned long long x, unsigned long long y) {
  if (x < y) return x;
  return y;
}
unsigned long long max(unsigned long long x, unsigned long long y) {
  if (x < y) return y;
  return x;
}
long long min(long long x, long long y) {
  if (x < y) return x;
  return y;
}
long long max(long long x, long long y) {
  if (x < y) return y;
  return x;
}
double min(double x, double y) {
  if (x < y) return x;
  return y;
}
double max(double x, double y) {
  if (x < y) return y;
  return x;
}
unsigned long long gcd(unsigned long long x, unsigned long long y) {
  if (!x) return y;
  if (!y) return x;
  if (x > y) swap(x, y);
  return gcd(x, y % x);
}
unsigned long long inv(unsigned long long a, unsigned long long c) {
  if (a == 1) {
    return 1;
  }
  return ((c - (c / a)) * inv(c % a, c)) % c;
}
char chi[62];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  for (int i = 0; i < 10; i++) {
    chi[i] = (char)(i + 48);
  }
  for (int i = 10; i < 36; i++) {
    chi[i] = (char)((int)'a' + i - 10);
  }
  for (int i = 36; i < 62; i++) {
    chi[i] = (char)((int)'A' + i - 36);
  }
  int t;
  cin >> t;
  while (t--) {
    int r, c, k, cnt = 0;
    cin >> r >> c >> k;
    vector<string> cfc(r);
    char ans[r][c];
    for (int i = 0; i < r; i++) {
      cin >> cfc[i];
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cnt += cfc[i][j] == 'R';
      }
    }
    int q = cnt / k, x = cnt - (cnt / k) * k;
    int y = k - x;
    int cur = 0, i = 0, j = 0;
    for (int loop = 0; loop < x; loop++) {
      int cc = 0;
      while (cc < q + 1) {
        ans[i][j] = chi[cur];
        if (cfc[i][j] == 'R') cc++;
        if (!(i & 1))
          j++;
        else
          j--;
        if (j == c) {
          i++;
          j = c - 1;
        } else if (j == -1) {
          i++;
          j = 0;
        }
      }
      cur++;
    }
    for (int loop = 0; loop < y; loop++) {
      int cc = 0;
      while (cc < q) {
        ans[i][j] = chi[cur];
        if (cfc[i][j] == 'R') cc++;
        if (!(i & 1))
          j++;
        else
          j--;
        if (j == c) {
          i++;
          j = c - 1;
        } else if (j == -1) {
          i++;
          j = 0;
        }
      }
      cur++;
    }
    cur--;
    while (i < r) {
      ans[i][j] = chi[cur];
      if (!(i & 1))
        j++;
      else
        j--;
      if (j == c) {
        i++;
        j = c - 1;
      } else if (j == -1) {
        i++;
        j = 0;
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cout << ans[i][j];
      }
      cout << "\n";
    }
  }
  return 0;
}
