#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
int r, c, k;
void move(int &x, int &y) {
  if (x % 2 == 0) {
    y++;
    if (y == c) {
      y = c - 1;
      x++;
    }
  } else {
    y--;
    if (y == -1) {
      x++;
      y = 0;
    }
  }
  if (x >= r) {
    x = -1;
  }
}
char value(int x) {
  if (x < 26) {
    return x + 'a';
  }
  if (x >= 52) {
    return x - 52 + '0';
  }
  return x - 26 + 'A';
}
void solve() {
  cin >> r >> c >> k;
  vector<string> s(r);
  int rice = 0;
  for (int i = 0; i < r; i++) {
    cin >> s[i];
    for (auto v : s[i]) {
      if (v == 'R') {
        rice++;
      }
    }
  }
  vector<string> ans = s;
  int mini = rice / k;
  int cnt_maxi = rice % k;
  int cnt_mini = k - rice % k;
  int x = 0, y = 0;
  int chicken = 0;
  while (chicken < k) {
    if (cnt_mini > 0) {
      int sz = mini;
      while (sz > 0) {
        if (s[x][y] == 'R') {
          sz--;
        }
        ans[x][y] = value(chicken);
        move(x, y);
      }
      cnt_mini--;
    } else if (cnt_maxi > 0) {
      int sz = mini + 1;
      while (sz > 0) {
        if (s[x][y] == 'R') {
          sz--;
        }
        ans[x][y] = value(chicken);
        move(x, y);
      }
      cnt_maxi--;
    }
    chicken++;
  }
  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      if (ans[i][j] == '.') {
        ans[i][j] = value(chicken - 1);
      }
      cout << ans[i][j];
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int tc;
  cin >> tc;
  while (tc--) {
    solve();
  }
}
