#include <bits/stdc++.h>
using namespace std;
int main() {
  char map[62];
  for (int i = 0; i < 10; i++) {
    map[i] = char(i + '0');
  }
  for (int i = 10; i < 36; i++) {
    map[i] = char(i - 10 + 'a');
  }
  for (int i = 36; i < 62; i++) {
    map[i] = char(i - 36 + 'A');
  }
  int t;
  cin >> t;
  char farm[109][109];
  char result[109][109];
  while (t--) {
    int r, c, k;
    int count = 0;
    cin >> r >> c >> k;
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cin >> farm[i][j];
        if (farm[i][j] == 'R') {
          count++;
        }
      }
    }
    int chickens_with_extra = count % k;
    int rice_cells = count / k;
    int curr_chicken = 0;
    int curr_count = 0;
    int i = 0, j = 0;
    while (i < r) {
      result[i][j] = map[curr_chicken];
      if (farm[i][j] == 'R') {
        curr_count++;
      }
      int threshold = rice_cells + ((chickens_with_extra) ? 1 : 0);
      if (curr_count == threshold) {
        curr_count = 0;
        if (curr_chicken < k - 1) {
          curr_chicken++;
        }
        if (chickens_with_extra) {
          chickens_with_extra--;
        }
      }
      if (i % 2) {
        j--;
      } else {
        j++;
      }
      if (j == c) {
        i++;
        j--;
      }
      if (j == -1) {
        i++;
        j++;
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        cout << result[i][j];
      }
      cout << "\n";
    }
  }
  return 0;
}
