#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--)
#define REP(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define FORE(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define ALL(v) (v).begin(), (v).end()
#define IS_INF(x) (std::isinf(x))
#define IS_NAN(x) (std::isnan(x))
#define fi first
#define se second
#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define div ___div
#define next ___next
#define prev ___prev
#define left ___left
#define right ___right
#define __builtin_popcount __builtin_popcountll
using namespace std;
template<class X, class Y>
bool minimize(X &x, const Y &y) {
X eps = 1e-9;
if (x > y + eps) {
x = y;
return true;
} else return false;
}
template<class X, class Y>
bool maximize(X &x, const Y &y) {
X eps = 1e-9;
if (x + eps < y) {
x = y;
return true;
} else return false;
}
template<class T>
T Abs(const T &x) {
return (x < 0 ? -x : x);
}
/* Author: Van Hanh Pham */
/** END OF TEMPLATE - ACTUAL SOLUTION COMES HERE **/
const string SYMBOLS = "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890";
#define MAX 111
char board[MAX][MAX], res[MAX][MAX];
int numRow, numCol, numChicken;
void process(void) {
memset(board, 0, sizeof board);
memset(res, 0, sizeof res);
scanf("%d%d%d", &numRow, &numCol, &numChicken);
FOR(i, 1, numRow) scanf("%s", board[i] + 1);
bool leftToRight = true;
vector<pair<int, int>> cells;
FOR(i, 1, numRow) {
if (leftToRight) {
FOR(j, 1, numCol) cells.push_back(make_pair(i, j));
} else {
FORD(j, numCol, 1) cells.push_back(make_pair(i, j));
}
leftToRight ^= 1;
}
int totRice = 0;
FOR(i, 1, numRow) FOR(j, 1, numCol) if (board[i][j] == 'R') totRice++;
int avg = totRice / numChicken;
int diff = totRice % numChicken == 0 ? 0 : 1;
REP(i, numChicken) {
int cntRice = 0;
while (true) {
int x = cells.back().fi, y = cells.back().se;
cells.pop_back();
res[x][y] = SYMBOLS[i];
if (board[x][y] == 'R') {
totRice--;
cntRice++;
}
if (cntRice < avg) continue;
if (avg * (numChicken - i - 1) <= totRice && totRice <= (avg + diff) * (numChicken - i - 1)) break;
}
}
while (!cells.empty()) {
int x = cells.back().fi, y = cells.back().se;
cells.pop_back();
res[x][y] = SYMBOLS[numChicken - 1];
}
FOR(i, 1, numRow) {
FOR(j, 1, numCol) printf("%c", res[i][j]); printf("\n");
}
}
int main(void) {
int t; scanf("%d", &t);
REP(love, t) process();
return 0;
}
/*** LOOK AT MY CODE. MY CODE IS AMAZING :D ***/