#include <bits/stdc++.h>
int main() {
  const std::string charator =
      "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  std::cin.tie(0);
  std::cin.sync_with_stdio(false);
  int t;
  std::cin >> t;
  std::vector<std::string> state(100);
  for (auto _c = 0; _c < t; ++_c) {
    int row, column, k;
    std::cin >> row >> column >> k;
    int rice_count = 0;
    for (auto i = 0; i < row; ++i) {
      std::cin >> state[i];
      rice_count += std::count(state[i].begin(), state[i].end(), 'R');
    }
    int rest_chicken = k;
    int current_char = 0;
    int current_rice = rice_count / rest_chicken;
    std::string line(column, '0');
    for (auto r = 0; r < row; ++r) {
      for (auto ci = 0; ci < column; ++ci) {
        int c = ci;
        if (r % 2 == 1) {
          c = column - ci - 1;
        }
        line[c] = charator[current_char];
        if (state[r][c] == 'R') {
          --rice_count;
          if (--current_rice == 0) {
            if (--rest_chicken != 0) {
              ++current_char;
              current_rice = rice_count / rest_chicken;
            }
          }
        }
      }
      std::cout << line << '\n';
    }
  }
}
