#include <bits/stdc++.h>
using namespace std;
char character(int n) {
  if (n < 26) return 'a' + n;
  if (n < 52) return 'A' + (n - 26);
  return '0' + (n - 52);
}
char farm[101][101];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int r, c, k;
    cin >> r >> c >> k;
    int count = 0;
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        cin >> farm[i][j];
        if (farm[i][j] == 'R') {
          count++;
        }
      }
    }
    vector<int> ricePerChicken;
    for (int i = 0; i < k; i++) {
      ricePerChicken.push_back(count / k);
    }
    for (int i = 0; i < (count % k); i++) {
      ricePerChicken[i]++;
    }
    int index = 0;
    int current = 0;
    for (int i = 1; i <= r; i++) {
      if (index == k) {
        break;
      }
      if (i % 2 == 0) {
        for (int j = 1; j <= c; j++) {
          if (current == ricePerChicken[index]) {
            current = 0;
            index++;
          }
          if (index == k) {
            break;
          }
          if (farm[i][j] == 'R') {
            current++;
          }
          farm[i][j] = character(index);
        }
      } else {
        for (int j = c; j >= 1; j--) {
          if (current == ricePerChicken[index]) {
            current = 0;
            index++;
          }
          if (index == k) {
            break;
          }
          if (farm[i][j] == 'R') {
            current++;
          }
          farm[i][j] = character(index);
        }
      }
      if (index == k) {
        break;
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        if (farm[i][j] == '.') {
          cout << character(k - 1);
        } else {
          cout << farm[i][j];
        }
      }
      cout << "\n";
    }
  }
  return 0;
}
