//为了连贯,采取一条路形式,从第一行开始 也就是s型
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 106;
char str[MAXN][MAXN];
vector<char> ch;//存放鸡的名字
void init() {
for(char i='0'; i<='9'; i++) ch.emplace_back(i);
for(char i='A'; i<='Z'; i++) ch.emplace_back(i);
for(char i='a'; i<='z'; i++) ch.emplace_back(i);
}
int main() {
std::ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T;
init();
cin >> T;
while(T--) {
int r,c,k,cnt=0;
cin >> r >> c >> k;
for(int i=1; i<=r; i++) {
for(int j=1; j<=c; j++) {
cin >> str[i][j];
if(str[i][j]=='R') cnt++;//米的总的数目
}
}
int x=cnt/k;//需要拿最少的鸡的数量
int y=cnt%k;//需要拿最多的鸡的数量
int cht=0;
int xx=x;
if(y) xx++,y--;//最多拿
for(int i=1; i<=r; i++) {//行
if(i&1) {//如果是奇数行
for(int j=1; j<=c; j++) {//每一列
if(str[i][j]=='R')//如果是米
xx--,cnt--;//数量减1,总数减一
str[i][j]=ch[cht];//标记
if(!cnt) {//如果总书减到0了
str[i][j]=ch[cht];//说明没有米,赋值就行
continue;
}
if(!xx) {//如果需要的米 完了
if(y) xx=x+1,y--;//如果拿max的还没有搞完,就继续
else xx=x;
cht++;
}
}
} else {
for(int j=c; j>=1; j--) {//i=1结束了,但上面的那个还没有放完,就接着上面的,继续放,倒着
if(str[i][j]=='R') xx--,cnt--;
str[i][j]=ch[cht];
if(!cnt) {
str[i][j]=ch[cht];
continue;
}
if(!xx) {
if(y) xx=x+1,y--;
else xx=x;
cht++;
}
}
}
}
for(int i=1; i<=r; i++) {
for(int j=1; j<=c; j++)
cout << str[i][j];
cout << endl;
}
}
return 0;
}