#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inarr(arr,n); for(int i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(int i=0;i<n;i++) cout<<arr[i]<<' ';
#define ve vector
#define fi first
#define se second
#define pa pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ld long double
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define pii pair<int, int>
#define pll pair<ll,ll>
#define fr(i, a, b); for (int i = a; i < b; i++)
#define frn(i, a, b); for (int i = a; i > b; i--)
#define mk make_pair
#define setvector(vname,value,size); for(int i=0;i<size;i++)vname[i]=value;
#define sz(a) (int)((a).size())
#define deci fixed<<setprecision(9)
const ll inf = 9e18;
const ld pi = 2*acos(0.0);
ll t,r,c,k,a,b,cnt,curr;
ve<string> arr;
ve<ve<ll>> brr;
ll power(ll x,ll y)
{
   ll res=1ll;
   while(y>0)
   {
       if(y&1) res=res*x;
       y>>=1;
       x=x*x;
   }
   return res;
}
void solve()
{
	cnt=curr=0,arr.clear(),brr.clear();
    cin>>r>>c>>k;
    arr.resize(r),brr.resize(r);
    fr(i,0,r)cin>>arr[i],brr[i].resize(c,-1);
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(arr[i][j]=='R')cnt++;
        }
    }
    a=k-(cnt%k),b=cnt%k;
    cnt/=k;
    ll x=0,y=0,rot=0;
    while(a>0 || b>0)
    {
        ll tar;
        if(a>0)tar=cnt,a--;
        else tar=cnt+1,b--;
        while(tar>0)
        {
            if(rot==0)
            {
                while(y<c && tar>0)
                {
                    if(arr[x][y]=='R')tar--;
                    brr[x][y]=curr;
                    y++;
                }
                if(y==c)y=c-1,x++,rot=1;
                if(tar==0)break;
            }
            if(rot==1)
            {
                while(y>-1 && tar>0)
                {
                   if(arr[x][y]=='R')tar--;
                   brr[x][y]=curr;
                   y--;
                }
                if(y==-1)y=0,x++,rot=0;
            }
        }
        curr++;
    }
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(brr[i][j]==-1)brr[i][j]=curr-1;
            if(brr[i][j]<10)
            {
              cout<<brr[i][j];
            }
            else if(brr[i][j]<36)
            {
                char x=brr[i][j]-10+'a';
                cout<<x;
            }
            else
            {
               char x=brr[i][j]-36+'A';
               cout<<x;
            }
        }
        cout<<endl;
    }
}
int32_t main(void)
{
    fastio;
    cin>>t;
    while(t--)
    {
        solve();
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inarr(arr,n); for(int i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(int i=0;i<n;i++) cout<<arr[i]<<' ';
#define ve vector
#define fi first
#define se second
#define pa pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ld long double
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define pii pair<int, int>
#define pll pair<ll,ll>
#define fr(i, a, b); for (int i = a; i < b; i++)
#define frn(i, a, b); for (int i = a; i > b; i--)
#define mk make_pair
#define setvector(vname,value,size); for(int i=0;i<size;i++)vname[i]=value;
#define sz(a) (int)((a).size())
#define deci fixed<<setprecision(9)
const ll inf = 9e18;
const ld pi = 2*acos(0.0);
ll t,n,r,c,k,a,b,cnt,curr,temp;
ve<string> arr;
ve<ve<bool>> rec;
ve<ve<ll>> brr;
ll power(ll x,ll y)
{
   ll res=1ll;
   while(y>0)
   {
       if(y&1) res=res*x;
       y>>=1;
       x=x*x;
   }
   return res;
}
void solve()
{
    arr.clear(),cnt=a=b=curr=0,brr.clear();
    cin>>r>>c>>k;
    brr.resize(r),arr.resize(r);
    fr(i,0,r)brr[i].resize(c,-1);
    fr(i,0,r)cin>>arr[i];
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(arr[i][j]=='R')cnt++;
        }
    }
    a=k-(cnt%k),b=cnt%k;
    cnt/=k;
    ll x=0,y=0,rot=0;
    while(a!=0 || b!=0)
    {
        ll tar;
        if(a>0)tar=cnt,a--;
        else tar=cnt+1,b--;
        while(tar!=0)
        {
            if(rot==0)
            {
                while(y!=c)
                {
                    if(arr[x][y]=='R')tar--;
                    brr[x][y]=curr;
                    y++;
                    if(tar==0)break;
                }
                if(y==c)y==c-1,x++,rot=1;
                if(tar==0)break;
            }
            if(rot==1)
            {
                while(y!=-1)
                {
                    if(arr[x][y]=='R')tar--;
                    brr[x][y]=curr;
                    y--;
                    if(tar==0)break;
                }
                if(y==-1)y=0,x++,rot=0;
                if(tar==0)break;
            }
        }
        curr++;
    }
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(brr[i][j]==-1)brr[i][j]=curr-1;
            if(brr[i][j]<10)
            {
                cout<<brr[i][j];
            }
            else if(brr[i][j]<36)
            {
                char x=brr[i][j]-10+'a';
                cout<<x;
            }
            else
            {
                char x=brr[i][j]-36+'A';
                cout<<x;
            }
        }
        cout<<endl;
    }
}
int32_t main(void)
{
    fastio;
    cin>>t;
    while(t--)
    {
        solve();
    }
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mod 1000000007
#define endl "\n"
#define inarr(arr,n); for(int i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(int i=0;i<n;i++) cout<<arr[i]<<' ';
#define ve vector
#define fi first
#define se second
#define pa pair
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ld long double
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define all(c) c.begin(),c.end()
#define pii pair<int, int>
#define pll pair<ll,ll>
#define fr(i, a, b); for (int i = a; i < b; i++)
#define frn(i, a, b); for (int i = a; i > b; i--)
#define mk make_pair
#define setvector(vname,value,size); for(int i=0;i<size;i++)vname[i]=value;
#define sz(a) (int)((a).size())
#define deci fixed<<setprecision(9)
const ll inf = 9e18;
const ld pi = 2*acos(0.0);
ll t,n,r,c,k,a,b,cnt,curr,temp;
ve<string> arr;
ve<ve<bool>> rec;
ve<ve<ll>> brr;
ll power(ll x,ll y)
{
   ll res=1ll;
   while(y>0)
   {
       if(y&1) res=res*x;
       y>>=1;
       x=x*x;
   }
   return res;
}
void dfs(ll x,ll y,ll tar,ll ind)
{
    if(temp==tar)return;
    if(rec[x][y])return;
    rec[x][y]=true;
    brr[x][y]=ind;
    if(arr[x][y]=='R')temp++;
    if(x-1>=0)dfs(x-1,y,tar,ind);
    if(y-1>=0)dfs(x,y-1,tar,ind);
    if(x+1<r)dfs(x+1,y,tar,ind);
    if(y+1<c)dfs(x,y+1,tar,ind);
}
void bfs()
{
    list<pa<ll,ll>> que;
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(rec[i][j])que.pb(mk(i,j));
        }
    }
    while(!que.empty())
    {
        pa<ll,ll> temp=que.front();
        que.pop_front();
        if(temp.first-1>=0 && !rec[temp.first-1][temp.second])
        {
            rec[temp.first-1][temp.second]=true;
            que.pb(mk(temp.first-1,temp.second));
            brr[temp.first-1][temp.second]=brr[temp.first][temp.second];
        }
        if(temp.second-1>=0 && !rec[temp.first][temp.second-1])
        {
            rec[temp.first][temp.second-1]=true;
            que.pb(mk(temp.first,temp.second-1));
            brr[temp.first][temp.second-1]=brr[temp.first][temp.second];
        }
        if(temp.first+1<r && !rec[temp.first+1][temp.second])
        {
            rec[temp.first+1][temp.second]=true;
            que.pb(mk(temp.first+1,temp.second));
            brr[temp.first+1][temp.second]=brr[temp.first][temp.second];
        }
        if(temp.second+1<c && !rec[temp.first][temp.second+1])
        {
            rec[temp.first][temp.second+1]=true;
            que.pb(mk(temp.first,temp.second+1));
            brr[temp.first][temp.second+1]=brr[temp.first][temp.second];
        }
    }
}
void solve()
{
    arr.clear(),cnt=a=b=curr=0,rec.clear(),brr.clear();
    cin>>r>>c>>k;
    rec.resize(r),brr.resize(r),arr.resize(r);
    fr(i,0,r)rec[i].resize(c,false),brr[i].resize(c,-1);
    fr(i,0,r)cin>>arr[i];
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(arr[i][j]=='R')cnt++;
        }
    }
    a=k-(cnt%k),b=cnt%k;
    cnt/=k;
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(!rec[i][j] && arr[i][j]=='R')
            {
                temp=0;
                if(a>0)
                {
                    a--;
                    dfs(i,j,cnt,curr);
                }
                else
                {
                    dfs(i,j,cnt+1,curr);
                }
                curr++;
            }
        }
    }
    bfs();
    fr(i,0,r)
    {
        fr(j,0,c)
        {
            if(brr[i][j]<10)
            {
                cout<<brr[i][j];
            }
            else if(brr[i][j]<36)
            {
                char x=brr[i][j]-10+'a';
                cout<<x;
            }
            else
            {
                char x=brr[i][j]-36+'A';
                cout<<x;
            }
        }
        cout<<endl;
    }
}
int32_t main(void)
{
    fastio;
    cin>>t;
    while(t--)
    {
        solve();
    }
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=200005;
char s[1050][1050];
int vis[1050][1050];
int dr[8][2]={{0,1},{1,0},{0,-1},{-1,0}};
int d,f;
int n,m;
int flag;
void dfs(int x,int y,int id,int sum,int g)
{
    if(sum>=g)
    return;
    if(flag==1)
        return;
    if(vis[x][y]==0)
    {
        vis[x][y]=id;
        if(s[x][y]=='R')
            sum++;
        if(sum>=g)
        {
            flag=1;
            return;
        }
        for(int i=0;i<4;i++)
        {
            int xx=x+dr[i][0];
            int yy=y+dr[i][1];
            if(xx>n||yy>m||xx<1||yy<1)
                continue;
            dfs(xx,yy,id,sum,g);
            if(flag==1)
            return;
        }
    }
    return;
}

int dfs2(int x,int y)
{

    if(vis[x][y]!=0)
        return vis[x][y];
    int e=0;
    for(int i=0;i<4;i++)
    {
        int xx=x+dr[i][0];
        int yy=y+dr[i][1];
        if(xx>n||yy>m||xx<1||yy<1)
            continue;
        e=dfs2(xx,yy);
        break;
    }
    return vis[x][y]=e;
}

int main()
{
    sync;
    int t,r;
    cin>>t;
    while(t--)
    {
        mm(vis);
        cin>>n>>m>>r;
        int w=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>s[i][j];
                if(s[i][j]=='R')
                    w++;
            }
        }
        if(w%r==0)
        {
            d=w/r;
            f=r;
        }
        else
        {
            d=w/r+1;
            f=w%r;
        }
//        cout<<d<<' '<<f<<' '<<r<<endl;
        int fl=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    flag=0;
                    dfs(i,j,fl,0,d);
                    fl++;
                    if(fl>f)
                        break;
                }
            }
            if(fl>f)
            break;
        }
//        for(int i=1;i<=n;i++)
//        {
//            for(int j=1;j<=m;j++)
//            {
//                cout<<vis[i][j];
//            }
//            cout<<endl;
//        }
//        cout<<endl;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    flag=0;
                    dfs(i,j,fl,0,d-1);
                    fl++;
                    if(fl>r)
                        break;
                }
            }
            if(fl>r)
            break;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0)
                {
                    vis[i][j]=dfs2(i,j);
                }
            }
        }
        int q;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                q=vis[i][j];
                if(1<=q&&q<=10)
                    cout<<q-1;
                else if(q<=36)
                    cout<<char('a'+(q-11));
                else
                    cout<<char('a'+(q-37));
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=200005;
char s[1050][1050];
int vis[1050][1050];
int dr[8][2]={{0,1},{1,0},{0,-1},{-1,0}};
int d,f;
int n,m;
int flag;
void dfs(int x,int y,int id,int sum,int g)
{
    if(sum>=g)
    return;
    if(flag==1)
        return;
    if(vis[x][y]==0)
    {
        vis[x][y]=id;
        if(s[x][y]=='R')
            sum++;
        if(sum>=g)
        {
            flag=1;
            return;
        }
        for(int i=0;i<4;i++)
        {
            int xx=x+dr[i][0];
            int yy=y+dr[i][1];
            if(xx>n||yy>m||xx<1||yy<1)
                continue;
            dfs(xx,yy,id,sum,g);
            if(flag==1)
            return;
        }
    }
    return;
}

int dfs2(int x,int y)
{

    if(vis[x][y]!=0)
        return vis[x][y];
    int e=0;
    for(int i=0;i<4;i++)
    {
        int xx=x+dr[i][0];
        int yy=y+dr[i][1];
        if(xx>n||yy>m||xx<1||yy<1)
            continue;
        e=dfs2(xx,yy);
        break;
    }
    return vis[x][y]=e;
}

int main()
{
    sync;
    int t,r;
    cin>>t;
    while(t--)
    {
        mm(vis);
        cin>>n>>m>>r;
        int w=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>s[i][j];
                if(s[i][j]=='R')
                    w++;
            }
        }
        if(w%r==0)
        {
            d=w/r;
            f=r;
        }
        else
        {
            d=w/r+1;
            f=w%r;
        }
//        cout<<d<<' '<<f<<' '<<r<<endl;
        int fl=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    flag=0;
                    dfs(i,j,fl,0,d);
                    fl++;
                    if(fl>f)
                        break;
                }
            }
            if(fl>f)
            break;
        }
//        for(int i=1;i<=n;i++)
//        {
//            for(int j=1;j<=m;j++)
//            {
//                cout<<vis[i][j];
//            }
//            cout<<endl;
//        }
//        cout<<endl;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    flag=0;
                    dfs(i,j,fl,0,d-1);
                    fl++;
                    if(fl>r)
                        break;
                }
            }
            if(fl>r)
            break;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0)
                {
                    vis[i][j]=dfs2(i,j);
                }
            }
        }
        int q;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                q=vis[i][j];
                if(1<=q&&q<=10)
                    cout<<q-1;
                else if(q<=36)
                    cout<<char('a'+(q-11));
                else
                    cout<<char('A'+(q-37));
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=200005;
char s[105][105];
int vis[105][105];
int dr[8][2]={{0,1},{1,0},{0,-1},{-1,0}};
int d,f;
int n,m;
int flag;
void dfs(int x,int y,int id,int sum,int g)
{
    if(sum>=g)
    return;
    if(flag==1)
        return;
    if(vis[x][y]==0)
    {
        vis[x][y]=id;
        if(s[x][y]=='R')
            sum++;
        if(sum>=g)
        {
            flag=1;
            return;
        }
        for(int i=0;i<4;i++)
        {
            int xx=x+dr[i][0];
            int yy=y+dr[i][1];
            if(xx>n||yy>m||xx<1||yy<1)
                continue;
            dfs(xx,yy,id,sum,g);
            if(flag==1)
            return;
        }
    }
    return;
}

int dfs2(int x,int y)
{

    if(vis[x][y]!=0)
        return vis[x][y];
    int e=0;
    for(int i=0;i<4;i++)
    {
        int xx=x+dr[i][0];
        int yy=y+dr[i][1];
        if(xx>n||yy>m||xx<1||yy<1)
            continue;
        e=dfs2(xx,yy);
        break;
    }
    return vis[x][y]=e;
}

int main()
{
    sync;
    int t,r;
    cin>>t;
    while(t--)
    {
        mm(vis);
        cin>>n>>m>>r;
        int w=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>s[i][j];
                if(s[i][j]=='R')
                    w++;
            }
        }
        if(w%r==0)
        {
            d=w/r;
            f=r;
        }
        else
        {
            d=w/r+1;
            f=w%r;
        }
//        cout<<d<<' '<<f<<' '<<r<<endl;
        int fl=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    flag=0;
                    dfs(i,j,fl,0,d);
                    fl++;
                    if(fl>f)
                        break;
                }
            }
            if(fl>f)
            break;
        }
//        for(int i=1;i<=n;i++)
//        {
//            for(int j=1;j<=m;j++)
//            {
//                cout<<vis[i][j];
//            }
//            cout<<endl;
//        }
//        cout<<endl;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    flag=0;
                    dfs(i,j,fl,0,d-1);
                    fl++;
                    if(fl>r)
                        break;
                }
            }
            if(fl>r)
            break;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0)
                {
                    vis[i][j]=dfs2(i,j);
                }
            }
        }
        int q;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                q=vis[i][j];
                if(1<=q&&q<=10)
                    cout<<q-1;
                else if(q<=36)
                    cout<<char('a'+(q-11));
                else
                    cout<<char('A'+(q-37));
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=200005;
char s[1050][1050];
int vis[1050][1050];
int dr[8][2]={{0,1},{1,0},{0,-1},{-1,0}};
int d,f;
int n,m;
void dfs(int x,int y,int id,int sum,int g)
{
    if(vis[x][y]==0)
    {
        vis[x][y]=id;
        if(s[x][y]=='R')
            sum++;
        if(sum>=g)
            return;
        for(int i=0;i<4;i++)
        {
            int xx=x+dr[i][0];
            int yy=y+dr[i][1];
            if(xx>n||yy>m||xx<1||yy<1)
                continue;
            dfs(xx,yy,id,sum,g);
        }
    }
    return;
}

int dfs2(int x,int y)
{

    if(vis[x][y]!=0)
        return vis[x][y];
    int e=0;
    for(int i=0;i<4;i++)
    {
        int xx=x+dr[i][0];
        int yy=y+dr[i][1];
        if(xx>n||yy>m||xx<1||yy<1)
            continue;
        e=dfs2(xx,yy);
        break;
    }
    return vis[x][y]=e;
}

int main()
{
    sync;
    int t,r;
    cin>>t;
    while(t--)
    {
        mm(vis);
        cin>>n>>m>>r;
        int w=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>s[i][j];
                if(s[i][j]=='R')
                    w++;
            }
        }
        if(w%r==0)
        {
            d=w/r;
            f=r;
        }
        else
        {
            d=w/r+1;
            f=w%r;
        }
        int fl=1;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    dfs(i,j,fl,0,d);
                    fl++;
                    if(fl>f)
                        break;
                }
            }
            if(fl>f)
            break;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0&&s[i][j]=='R')
                {
                    dfs(i,j,fl,0,d-1);
                    fl++;
                    if(fl>r)
                        break;
                }
            }
            if(fl>r)
            break;
        }
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                if(vis[i][j]==0)
                {
                    vis[i][j]=dfs2(i,j);
                }
            }
        }
        int q;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                q=vis[i][j];
                if(1<=q&&q<=10)
                    cout<<q-1;
                else if(q<=36)
                    cout<<char('a'+(q-11));
                else
                    cout<<char('a'+(q-37));
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=200005;
char s[105][105];
int vis[105][105];
int dr[8][2]={{0,1},{1,0},{0,-1},{-1,0}};
int d,f;
int n,m;
//int flag;
//void dfs(int x,int y,int id,int sum,int g)
//{
//    if(sum>=g)
//    return;
//    if(flag==1)
//        return;
//    if(vis[x][y]==0)
//    {
//        vis[x][y]=id;
//        if(s[x][y]=='R')
//            sum++;
//        if(sum>=g)
//        {
//            flag=1;
//            return;
//        }
//        for(int i=0;i<4;i++)
//        {
//            int xx=x+dr[i][0];
//            int yy=y+dr[i][1];
//            if(xx>n||yy>m||xx<1||yy<1)
//                continue;
//            dfs(xx,yy,id,sum,g);
//            if(flag==1)
//            return;
//        }
//    }
//    return;
//}
//
//int dfs2(int x,int y)
//{
//
//    if(vis[x][y]!=0)
//        return vis[x][y];
//    int e=0;
//    for(int i=0;i<4;i++)
//    {
//        int xx=x+dr[i][0];
//        int yy=y+dr[i][1];
//        if(xx>n||yy>m||xx<1||yy<1)
//            continue;
//        e=dfs2(xx,yy);
//        break;
//    }
//    return vis[x][y]=e;
//}

int main()
{
    sync;
    int t,r;
    cin>>t;
    while(t--)
    {
        mm(vis);
        cin>>n>>m>>r;
        int w=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>s[i][j];
                if(s[i][j]=='R')
                    w++;
            }
        }
        if(w%r==0)
        {
            d=w/r;
            f=r;
        }
        else
        {
            d=w/r+1;
            f=w%r;
        }
//        cout<<d<<' '<<f<<' '<<r<<endl;
        int fl=1;
        int sum=0;
        for(int i=1;i<=n;i++)
        {
            if(i%2==0)
            {
                for(int j=1;j<=m;j++)
                {
                    vis[i][j]=fl;
                    if(s[i][j]=='R')
                    {
                        sum++;
                        if(sum==d&&fl<r)
                        {
                            fl++;
                            sum=0;
                            if(fl==f+1)
                                d--;
                        }
                    }
                }
            }
            else
            {
                for(int j=m;j>=1;j--)
                {
                    vis[i][j]=fl;
                    if(s[i][j]=='R')
                    {
                        sum++;
                        if(sum==d&&fl<r)
                        {
                            fl++;
                            sum=0;
                            if(fl==f+1)
                                d--;
                        }
                    }
                }
            }
        }

        int q;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                q=vis[i][j];
                if(1<=q&&q<=10)
                    cout<<q-1;
                else if(q<=36)
                    cout<<char('a'+(q-11));
                else
                    cout<<char('A'+(q-37));
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
#include<map>
typedef long long ll;
#define mm(a) memset(a,0,sizeof(a))
#define lr rt<<1
#define rr rt<<1|1
#define sync std::ios::sync_with_stdio(false);std::cin.tie(0);
#define inf 0x3f3f3f3f
using namespace std;
const int maxn=200005;
char s[105][105];
int vis[105][105];
int dr[8][2]={{0,1},{1,0},{0,-1},{-1,0}};
int d,f;
int n,m;
//int flag;
//void dfs(int x,int y,int id,int sum,int g)
//{
//    if(sum>=g)
//    return;
//    if(flag==1)
//        return;
//    if(vis[x][y]==0)
//    {
//        vis[x][y]=id;
//        if(s[x][y]=='R')
//            sum++;
//        if(sum>=g)
//        {
//            flag=1;
//            return;
//        }
//        for(int i=0;i<4;i++)
//        {
//            int xx=x+dr[i][0];
//            int yy=y+dr[i][1];
//            if(xx>n||yy>m||xx<1||yy<1)
//                continue;
//            dfs(xx,yy,id,sum,g);
//            if(flag==1)
//            return;
//        }
//    }
//    return;
//}
//
//int dfs2(int x,int y)
//{
//
//    if(vis[x][y]!=0)
//        return vis[x][y];
//    int e=0;
//    for(int i=0;i<4;i++)
//    {
//        int xx=x+dr[i][0];
//        int yy=y+dr[i][1];
//        if(xx>n||yy>m||xx<1||yy<1)
//            continue;
//        e=dfs2(xx,yy);
//        break;
//    }
//    return vis[x][y]=e;
//}

int main()
{
    sync;
    int t,r;
    cin>>t;
    while(t--)
    {
        mm(vis);
        cin>>n>>m>>r;
        int w=0;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                cin>>s[i][j];
                if(s[i][j]=='R')
                    w++;
            }
        }
        if(w%r==0)
        {
            d=w/r;
            f=r;
        }
        else
        {
            d=w/r+1;
            f=w%r;
        }
//        cout<<d<<' '<<f<<' '<<r<<endl;
        int fl=1;
        int sum=0;
        for(int i=1;i<=n;i++)
        {
            if(i%2==0)
            {
                for(int j=1;j<=m;j++)
                {
                    vis[i][j]=fl;
                    if(s[i][j]=='R')
                    {
                        sum++;
                        if(sum==d+1)
                        {
                            fl++;
                            vis[i][j]=fl;
                            sum=1;
                            if(fl==r+1)
                            d--;
                        }
                    }
                }
            }
            else
            {
                for(int j=m;j>=1;j--)
                {
                    vis[i][j]=fl;
                    if(s[i][j]=='R')
                    {
                        sum++;
                        if(sum==d+1)
                        {
                            fl++;
                            vis[i][j]=fl;
                            sum=1;
                            if(fl==r+1)
                            d--;
                        }
                    }
                }
            }
        }

        int q;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)
            {
                q=vis[i][j];
                if(1<=q&&q<=10)
                    cout<<q-1;
                else if(q<=36)
                    cout<<char('a'+(q-11));
                else
                    cout<<char('A'+(q-37));
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[70];
char ans[70][70];
string pick="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,r,c,ri=0,st=0,ok=1;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k,ex=ri%k,cr=1,cr2=1,cr3=0;
		ok=0;
		for(i=0;i<r;i++){
			for(j=(i&1)?c-1:0;(i&1)?(j>=0):j<c;j+=(i&1)?-1:1){
				//cout<<"*"<<" "<<st<<endl;
				if(ex>0){

				ans[i][j]=pick[st];
					if(s[i][j]=='R'){
					    cr3++;
						if(cr2%(mx+1)==0){
							st++;
							ex--;
						}
						cr2++;
					}
				}
				else{

				ans[i][j]=pick[st];
					if(s[i][j]=='R'){
					    cr3++;
						if(cr%mx==0)
						st++;
						cr++;
					}
				}
				if(cr3==ri&&!ok){
				    st--;
				    ok=1;
				}
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[170];
char ans[170][170];
string pick="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,r,c,ri=0,st=0,ok=1;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k,ex=ri%k,cr=1,cr2=1,cr3=0;
		ok=0;
		for(i=0;i<r;i++){
			for(j=(i&1)?c-1:0;(i&1)?(j>=0):j<c;j+=(i&1)?-1:1){
				//cout<<"*"<<" "<<st<<endl;
				if(ex>0){

				ans[i][j]=pick[st];
					if(s[i][j]=='R'){
					    cr3++;
						if(cr2%(mx+1)==0){
							st++;
							ex--;
						}
						cr2++;
					}
				}
				else{

				ans[i][j]=pick[st];
					if(s[i][j]=='R'){
					    cr3++;
						if(cr%mx==0)
						st++;
						cr++;
					}
				}
				if(cr3==ri&&!ok){
				    st--;
				    ok=1;
				}
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[70];
char ans[70][70];
int r,c;
bool inside(int x,int y){
	if(x>=0&&x<=r&&y>=0&&y<=c&&ans[x][y]=='\0')
	return 1;
	else
	return 0;
}
void dfs(int i,int j,char ch){
	ans[i][j]=ch;
	if(inside(i+1,j))
	dfs(i+1,j,ch);
	if(inside(i,j+1))
	dfs(i,j+1,ch);
	if(inside(i-1,j))
	dfs(i-1,j,ch);
	if(inside(i,j-1))
	dfs(i,j-1,ch);
}
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,ri=0,st=49;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k;
		memset(ans,'\0',sizeof ans);
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				if(mx>1){
					if(s[i][j]=='R'){
						ans[i][j]=(char)(st);
						mx--;
					}
				}
				else{
					if(s[i][j]=='R'){
						st++;
						ans[i][j]=(char)(st);
					}
				}
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				if(ans[i][j]!='\0')
				dfs(i,j,ans[i][j]);
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[70];
char ans[70][70];
string pick="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,r,c,ri=0,st=0,ok=1;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k,ex=ri%k,cr=1,cr2=1;
		ok=0;
		for(i=0;i<r;i++){
			for(j=(i&1)?c-1:0;(i&1)?(j>=0):j<c;j+=(i&1)?-1:1){
				//cout<<"*"<<" "<<st<<endl;
				if(ex>0){
					if(s[i][j]=='R'){
						if(cr2%(mx+1)==0){
							st++;
							ex--;
						}
						cr2++;
					}
				}
				else{
					if(s[i][j]=='R'){
						if(cr%mx==0)
						st++;
						cr++;
					}
				}
				if(cr+cr2==ri&&!ok){
				    st--;
				    ok=1;
				}
				ans[i][j]=pick[st];
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[70];
char ans[70][70];
int r,c;
string pick="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
bool inside(int x,int y){
	if(x>=0&&x<=r&&y>=0&&y<=c&&ans[x][y]=='\0')
	return 1;
	else
	return 0;
}
void dfs(int i,int j,char ch){
	ans[i][j]=ch;
	if(inside(i+1,j))
	dfs(i+1,j,ch);
	if(inside(i,j+1))
	dfs(i,j+1,ch);
	if(inside(i-1,j))
	dfs(i-1,j,ch);
	if(inside(i,j-1))
	dfs(i,j-1,ch);
}
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,ri=0,st=0,ok=0;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k;
		if(mx==1)ok=1;
		memset(ans,'\0',sizeof ans);
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				if(mx>1){
					if(s[i][j]=='R'){
						ans[i][j]=pick[st];
						mx--;
					}
				}
				else{
					if(s[i][j]=='R'){
						++st;
						if(ok)--st,ok=0;
						ans[i][j]=pick[st];
					}
				}
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				if(ans[i][j]!='\0')
				dfs(i,j,ans[i][j]);
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[70];
char ans[70][70];
string pick="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,r,c,ri=0,st=0,ok=1;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k,ex=ri%k,cr=1,cr2=1;
		if(ex==0)
		ok=1;
		for(i=0;i<r;i++){
			for(j=(i&1)?c-1:0;(i&1)?(j>=0):j<c;j+=(i&1)?-1:1){
				//cout<<"*"<<" "<<st<<endl;
				if(ex>0){
					ans[i][j]=pick[st];
					if(s[i][j]=='R'){
						if(cr2%(mx+1)==0){
							st++;
							ex--;
						}
						cr2++;
					}
				}
				else{
					ans[i][j]=pick[st];
					if(s[i][j]=='R'){
						if(cr%mx==0)
						st++;
						cr++;
					}
				}
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include<bits/stdc++.h>
#include<iomanip>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define mxn 500005
#define mod 1000000007
#define ld long double
#define pb push_back
#define inf 1e18
#define fi first
#define se second
typedef long long int ll;
using  namespace std;
string s[70];
char ans[70][70];
string pick="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int main(void){
	#ifndef ONLINE_JUDGE
	freopen("input1.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	fast;
	int t,i,j;
	cin>>t;
	while(t--){
		int k,r,c,ri=0,st=0,ok=1;
		cin>>r>>c>>k;
		for(i=0;i<r;i++)
		cin>>s[i];
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			if(s[i][j]=='R')
			ri++;
		}
		int mx=ri/k,ex=ri%k,cr=1,cr2=1;
		if(ex==0)
		ok=1;
		for(i=0;i<r;i++){
			for(j=0;j<c;j++){
				//cout<<"*"<<" "<<st<<endl;
				if(ex>0){
					ans[i][j]=pick[st];
					if(s[i][j]=='R'){
						if(cr2%(mx+1)==0){
							st++;
							ex--;
						}
						cr2++;
					}
				}
				else{
					ans[i][j]=pick[st];
					if(s[i][j]=='R'){
						if(cr%mx==0)
						st++;
						cr++;
					}
				}
			}
		}
		for(i=0;i<r;i++){
			for(j=0;j<c;j++)
			cout<<ans[i][j];
			cout<<endl;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "0987654321mnbvcxzlkjhgfdsapoiuytrewqMNBVCXZLKJHGFDSAPOIUYTREWQ";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            if(g[i][j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][m - 1 - j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need && losers > 0) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
    }
}

/*
3
3 3 2
...
...
..R

3 3 2
R..
...
...

3 3 2
R..
.R.
...
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "0987654321mnbvcxzlkjhgfdsapoiuyQWERTYUIOPASDFGHJKLZXCVBNMqwert";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            if(g[i][j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][m - 1 - j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need && losers > 0) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
    }
}

/*
3
3 3 2
...
...
..R

3 3 2
R..
...
...

3 3 2
R..
.R.
...
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            if(g[i][j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][m - 1 - j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need && losers > 0) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
    }
}

/*
3
3 3 2
...
...
..R

3 3 2
R..
...
...

3 3 2
R..
.R.
...
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "0987654321mnbvcxzlkjhgfdsapoiuytrewqMNBVCXZLKJHGFDSAPOIUYTREWQ";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            if(g[i][m - 1 - j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][m - 1 - j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need && losers > 0) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
    }
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            if(g[i][j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][m - 1 - j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need && losers > 0) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
        cout << endl;
    }
}

/*
3
3 3 2
...
...
..R

3 3 2
R..
...
...

3 3 2
R..
.R.
...
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            if(g[i][j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][m - 1 - j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
        cout << endl;
    }
}

/*
3
3 3 2
...
...
..R

3 3 2
R..
...
...

3 3 2
R..
.R.
...
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxn = 101;
char g[maxn][maxn];
char answ[maxn][maxn];

string s = "0987654321mnbvcxzlkjhgfdsapoiuytrewqMNBVCXZLKJHGFDSAPOIUYTREWQ";
void one() {
    ll n, m, k, sum = 0;
    cin >> n >> m >> k;

    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cin >> g[i][j];
            if(g[i][j] == 'R') {
                sum ++;
            }
        }
    }
    ll need = sum/k;
    ll vip = sum%k, losers = k - vip;

    for(ll cnt = 0, i = 0, chick = 0; i < n; i++) {
        ll j0 = 0, j2 = m, jadd = 1;
        if(i%2 == 1) {
            j0 = m - 1; j2 = -1; jadd = -1;
        }
        for(ll j = j0; j != j2; j += jadd) {
            if(g[i][j] == 'R') {
                cnt++;
            }
            if(i%2 == 0) answ[i][j] = s[chick];
            else answ[i][j] = s[chick];
            if(cnt == need + 1) {
                vip--;
                chick++;
                cnt = 0;
            }
            else if(cnt == need && losers > 0) {
                losers--;
                chick++;
                cnt = 0;
            }
            if(chick == k) chick = k - 1;
        }
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < m; j++) {
            cout << answ[i][j];
        }
        cout << endl;
    }

}

int main() {
    // ifstream cin("kingdom.in");
    // ofstream cout("kingdom.out");
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--) {
        one();
    }
}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  IOS
  ll t;
  cin>>t;
  while(t--)
  {
    ll r,c,k;
    cin>>r>>c>>k;
    string s[r];
    ll a[r][c];
    char ans[r][c];
    vector<char> v;
    for(ll i=0;i<26;i++)
    {
      if(i<10)
        v.pb(('0'+i));
      v.pb(('a'+i));
      v.pb(('A'+i));

    }
    ll sum=0;
    for(ll i=0;i<r;i++)
    {
      cin>>s[i];
      for(ll j=0;j<c;j++)
      {
          if(s[i][j]=='.')
            a[i][j]=0;
          else
          {
            a[i][j]=1;
          }
          sum+=a[i][j];
      }
    }
    ll x=(sum/k)+1;

    ll y=sum%k;

    ll cnt=0;
    ll m=0;
    for(ll i=0;i<r;i++)
    {
      if(y==0)
        x--;
      if(i%2==0)
      {
        for(ll j=0;j<c;j++)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
            }
        }
      }
      else
      {
         for(ll j=c-1;j>=0;j--)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
            }
        }
      }

    }
    for(ll i=0;i<r;i++)
    {
      for(ll j=0;j<c;j++)
      {
        cout<<ans[i][j];
      }
      cout<<endl;
    }
  }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  IOS
  ll t;
  cin>>t;
  while(t--)
  {
    ll r,c,k;
    cin>>r>>c>>k;
    string s[r];
    ll a[r][c];
    char ans[r][c];
    vector<char> v;
    for(ll i=0;i<26;i++)
    {
      if(i<10)
        v.pb(('0'+i));
      v.pb(('a'+i));
      v.pb(('A'+i));

    }
    ll sum=0;
    for(ll i=0;i<r;i++)
    {
      cin>>s[i];
      for(ll j=0;j<c;j++)
      {
          if(s[i][j]=='.')
            a[i][j]=0;
          else
          {
            a[i][j]=1;
          }
          sum+=a[i][j];
      }
    }
    ll x=(sum/k)+1;

    ll y=sum%k;
    //trace(y);
    ll cnt=0;
    ll m=0;
    for(ll i=0;i<r;i++)
    {
      if(y==0)
        x--;
      if(i%2==0)
      {
        for(ll j=0;j<c;j++)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
              if(y==0)
                y=mod,x--;
            }
        }
      }
      else
      {
         for(ll j=c-1;j>=0;j--)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
              if(y==0)
                y=mod,x--;
            }
        }
      }

    }
    for(ll i=0;i<r;i++)
    {
      for(ll j=0;j<c;j++)
      {
        cout<<ans[i][j];
      }
      cout<<endl;
    }
  }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  IOS
  ll t;
  cin>>t;
  while(t--)
  {
    ll r,c,k;
    cin>>r>>c>>k;
    string s[r];
    ll a[r][c];
    char ans[r][c];
    vector<char> v;
    for(ll i=0;i<26;i++)
    {
      if(i<10)
        v.pb(('0'+i));
      v.pb(('a'+i));
      v.pb(('A'+i));

    }
    ll sum=0;
    for(ll i=0;i<r;i++)
    {
      cin>>s[i];
      for(ll j=0;j<c;j++)
      {
          if(s[i][j]=='.')
            a[i][j]=0;
          else
          {
            a[i][j]=1;
          }
          sum+=a[i][j];
      }
    }
    ll x=(sum/k)+1;
    ll y=sum%k;
    ll cnt=0;
    ll m=0;
    for(ll i=0;i<r;i++)
    {
      if(y==0)
        {y=mod;
        x--;}
      if(i%2==0)
      {
        for(ll j=0;j<c;j++)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
              if(y==0)
                {y=mod;
                x--;}
            }
        }
      }
      else
      {
         for(ll j=c-1;j>=0;j--)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
              if(y==0)
                {y=mod;
                x--;}
            }
        }
      }

    }
    for(ll i=0;i<r;i++)
    {
      for(ll j=0;j<c;j++)
      {
        cout<<ans[i][j];
      }
      cout<<endl;
    }
    //cout<<endl;
  }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  IOS
  ll t;
  cin>>t;
  while(t--)
  {
    ll r,c,k;
    cin>>r>>c>>k;
    string s[r];
    ll a[r][c];
    char ans[r][c];
    vector<char> v;
    for(ll i=0;i<26;i++)
    {
      if(i<10)
        v.pb(('0'+i));
      v.pb(('a'+i));
      v.pb(('A'+i));

    }
    ll sum=0;
    for(ll i=0;i<r;i++)
    {
      cin>>s[i];
      for(ll j=0;j<c;j++)
      {
          if(s[i][j]=='.')
            a[i][j]=0;
          else
          {
            a[i][j]=1;
          }
          sum+=a[i][j];
      }
    }
    ll x=(sum/k)+1;
    ll y=(sum%k);
    ll cnt=0;
    ll m=0;
    if(y==0)
      x--;
    for(ll i=0;i<r;i++)
    {

      if(i%2==0)
      {
        for(ll j=0;j<c;j++)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];

          if(cnt==x)
            {
              cnt=0;
              k--;
              if(k!=0)
               m++;

              y--;

              if(y==0)
                {
                  y=mod;
                  x--;
                }
            }
        }
      }
      else
      {
         for(ll j=c-1;j>=0;j--)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];

          if(cnt==x)
            {
              cnt=0;

              y--;
              k--;
              if(k!=0)
                m++;

              if(y==0)
                {y=mod;
                x--;}
            }
        }
      }

    }
    for(ll i=0;i<r;i++)
    {
      for(ll j=0;j<c;j++)
      {
        cout<<ans[i][j];
      }
      cout<<endl;
    }
    //cout<<endl;
  }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  IOS
  ll t;
  cin>>t;
  while(t--)
  {
    ll r,c,k;
    cin>>r>>c>>k;
    string s[r];
    ll a[r][c];
    char ans[r][c];
    vector<char> v;
    for(ll i=0;i<26;i++)
    {
      if(i<10)
        v.pb(('0'+i));
      v.pb(('a'+i));
      v.pb(('A'+i));

    }
    ll sum=0;
    for(ll i=0;i<r;i++)
    {
      cin>>s[i];
      for(ll j=0;j<c;j++)
      {
          if(s[i][j]=='.')
            a[i][j]=0;
          else
          {
            a[i][j]=1;
          }
          sum+=a[i][j];
      }
    }
    ll x=(sum/k)+1;
    ll y=(sum%k);
    ll cnt=0;
    ll m=0;
    for(ll i=0;i<r;i++)
    {

      if(i%2==0)
      {
        for(ll j=0;j<c;j++)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];

          if(cnt==x)
            {
              cnt=0;
              k--;
              if(k!=0)
               m++;

              y--;

              if(y==0)
                {
                  y=mod;
                  x--;
                }
            }
        }
      }
      else
      {
         for(ll j=c-1;j>=0;j--)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];

          if(cnt==x)
            {
              cnt=0;

              y--;
              k--;
              if(k!=0)
                m++;

              if(y==0)
                {y=mod;
                x--;}
            }
        }
      }

    }
    for(ll i=0;i<r;i++)
    {
      for(ll j=0;j<c;j++)
      {
        cout<<ans[i][j];
      }
      cout<<endl;
    }
    //cout<<endl;
  }

}


#include <bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...) 1
#endif
template<class T> ostream& operator<<(ostream &os, vector<T> V) {os << "[ "; for(auto v : V) os << v << " "; return os << "]";}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {return os << "(" << P.first << "," << P.second << ")";}

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =1e9+7;
const ll maxn =100001;
ll power(ll x, ll n) {
  ll res = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
  }
  return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
  #endif
  IOS
  ll t;
  cin>>t;
  while(t--)
  {
    ll r,c,k;
    cin>>r>>c>>k;
    string s[r];
    ll a[r][c];
    char ans[r][c];
    vector<char> v;
    for(ll i=0;i<26;i++)
    {
      if(i<10)
        v.pb(('0'+i));
      v.pb(('a'+i));
      v.pb(('A'+i));

    }
    ll sum=0;
    for(ll i=0;i<r;i++)
    {
      cin>>s[i];
      for(ll j=0;j<c;j++)
      {
          if(s[i][j]=='.')
            a[i][j]=0;
          else
          {
            a[i][j]=1;
          }
          sum+=a[i][j];
      }
    }
    ll x=(sum/k)+1;

    ll y=sum%k;

    ll cnt=0;
    ll m=0;
    for(ll i=0;i<r;i++)
    {

      if(i%2==0)
      {
        for(ll j=0;j<c;j++)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
              if(y==0)
                x--;
            }
        }
      }
      else
      {
         for(ll j=c-1;j>=0;j--)
        {
          cnt+=a[i][j];
          ans[i][j]=v[m];
          if(cnt==x)
            {
              cnt=0;
              m++;
              y--;
              if(y==0)
                x--;
            }
        }
      }

    }
    for(ll i=0;i<r;i++)
    {
      for(ll j=0;j<c;j++)
      {
        cout<<ans[i][j];
      }
      cout<<endl;
    }
  }

}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;

int n,m,k,cnt;
char mp[105][105],ans[105][105];
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*********";

int main()
{
//	freopen("in.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&n,&m,&k);
		for(int i=1;i<=n;i++)scanf("%s",mp[i]+1),ans[i][m+1]=0;

		cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mp[i][j]=='R')cnt++;
			}
		}

		int d=cnt/k,ID=cnt%k;
		if(ID==0)ID=1e9+7;
		else d++;

		int id=0,x=1,y=1,c=0,t=0,f1=0,f2=0;
		while(t<n*m){
			++t;
			ans[x][y]=alpha[id];
			if(mp[x][y]=='R')c++;
			if(c==d-(id>=ID))id++,c=0;
			id=min(id,k-1);

			if(n==1){
				y++;
				continue;
			}

			if(m==1){
				x++;
				contnue;
			}

			if(x==1 && f1==1){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x++;
				}
				continue;
			}

			if(x==n && f1==0){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x--;
				}
				continue;
			}

			if(f1==0)x++;
			else x--;
		}

		for(int i=1;i<=n;i++)printf("%s\n",ans[i]+1);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;

int n,m,k,cnt;
char mp[105][105],ans[105][105];
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*********";

int main()
{
//	freopen("in.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&n,&m,&k);
		for(int i=1;i<=n;i++)scanf("%s",mp[i]+1),ans[i][m+1]=0;

		cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mp[i][j]=='R')cnt++;
			}
		}

		int d=cnt/k,ID=cnt%k;
		if(ID==0)ID=1e9+7;
		else d++;

		int id=0,x=1,y=1,c=0,t=0,f1=0,f2=0;
		while(t<n*m){
			++t;
			ans[x][y]=alpha[id];
			if(mp[x][y]=='R')c++;
			if(c==d-(id>=ID))id++,c=0;
			id=min(id,k);

			if(n==1){
				y++;
				continue;
			}

			if(x==1 && f1==1){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x++;
				}
				continue;
			}

			if(x==n && f1==0){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x--;
				}
				continue;
			}

			if(f1==0)x++;
			else x--;
		}

		for(int i=1;i<=n;i++)printf("%s\n",ans[i]+1);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;

int n,m,k,cnt;
char mp[105][105],ans[105][105];
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*********";

int main()
{
//	freopen("in.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&n,&m,&k);
		for(int i=1;i<=n;i++)scanf("%s",mp[i]+1),ans[i][m+1]=0;

		cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mp[i][j]=='R')cnt++;
			}
		}

		int d=cnt/k,ID=cnt%k;
		if(ID==0)ID=1e9+7;
		else d++;

		int id=0,x=1,y=1,c=0,t=0,f1=0,f2=0;
		while(t<n*m){
			++t;
			ans[x][y]=alpha[id];
			if(mp[x][y]=='R')c++;
			if(c==d-(id>=ID))id++,c=0;
			id=min(id,k-1);

			if(n==1){
				y++;
				continue;
			}

			if(m==1){
				x++;
				continue;
			}

			if(x==1 && f1==1){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x++;
				}
				continue;
			}

			if(x==n && f1==0){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x--;
				}
				continue;
			}

			if(f1==0)x++;
			else x--;
		}

		for(int i=1;i<=n;i++)printf("%s\n",ans[i]+1);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;

int n,m,k,cnt;
char mp[105][105],ans[105][105];
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789*********";

int main()
{
//	freopen("in.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&n,&m,&k);
		for(int i=1;i<=n;i++)scanf("%s",mp[i]+1),ans[i][m+1]=0;

		cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mp[i][j]=='R')cnt++;
			}
		}

		int d=cnt/k,ID=cnt%k;
		if(ID==0)ID=1e9+7;
		else d++;

		int id=0,x=1,y=1,c=0,t=0,f1=0,f2=0;
		while(t<n*m){
			++t;
			ans[x][y]=alpha[id];
			if(mp[x][y]=='R')c++;
			if(c==d-(id>=ID))id++,c=0;
//			id=min(id,k-1);

			if(n==1){
				y++;
				continue;
			}

			if(x==1 && f1==1){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x++;
				}
				continue;
			}

			if(x==n && f1==0){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x--;
				}
				continue;
			}

			if(f1==0)x++;
			else x--;
		}

		for(int i=1;i<=n;i++)printf("%s\n",ans[i]+1);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;

int n,m,k,cnt;
char mp[105][105],ans[105][105];
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

int main()
{
//	freopen("in.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&n,&m,&k);
		for(int i=1;i<=n;i++)scanf("%s",mp[i]+1),ans[i][m+1]=0;

		cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mp[i][j]=='R')cnt++;
			}
		}
		int d=cnt/k; if(cnt%k)d++;

		int id=0,x=1,y=1,c=0,t=0,f1=0,f2=0;
		while(t<n*m){
			++t;
			ans[x][y]=alpha[id];
			if(mp[x][y]=='R')c++;
			if(c==d)id++,c=0;

			if(x==1 && f1==1){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x++;
				}
				continue;
			}

			if(x==n && f1==0){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x--;
				}
				continue;
			}

			if(f1==0)x++;
			else x--;
		}

		for(int i=1;i<=n;i++)printf("%s\n",ans[i]+1);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+5;

int n,m,k,cnt;
char mp[105][105],ans[105][105];
string alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

int main()
{
//	freopen("in.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d %d %d",&n,&m,&k);
		for(int i=1;i<=n;i++)scanf("%s",mp[i]+1),ans[i][m+1]=0;

		cnt=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++){
				if(mp[i][j]=='R')cnt++;
			}
		}

		int d=cnt/k+1,ID=cnt%k;

		int id=0,x=1,y=1,c=0,t=0,f1=0,f2=0;
		while(t<n*m){
			++t;
			ans[x][y]=alpha[id];
			if(mp[x][y]=='R')c++;
			if(c==d-(id>=ID))id++,c=0;

			if(x==1 && f1==1){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x++;
				}
				continue;
			}

			if(x==n && f1==0){
				if(f2==0){
					f2=1;
					y++;
				}
				else{
					f2=0;
					f1^=1;
					x--;
				}
				continue;
			}

			if(f1==0)x++;
			else x--;
		}

		for(int i=1;i<=n;i++)printf("%s\n",ans[i]+1);
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int vis[100][100];
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c && !vis[i][j];
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	vis[i][j] = 1;
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if(valid(nx, ny)) {
				q.push({nx, ny});
				vis[nx][ny] = 1;
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int c = '0'; c <= '9'; c++)
		ord.push_back(c);
	for(int c = 'a'; c <= 'z'; c++)
		ord.push_back(c);
	for(int c = 'A'; c <= 'Z'; c++)
		ord.push_back(c);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				vis[i][j] = 0;
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k) break;
				if(!vis[i][j]) {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] == '-') {
					if(i) ans[i][j] = ans[i-1][j];
					else if(j) ans[i][j] = ans[i][j-1];
				}
				cout << ans[i][j];
				if(j == c-1) cout << endl;
			}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, cur = 0;
		for(int i = 0; i < r; i += 2) {
			for(int j = 0; j < c; j++) {
				ans[i][j] = ord[at];
				if(mat[i][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					if(at == k) break;
				}
			}
			if(i+1 == r) break;
			for(int j = c-1; j >= 0; j--) {
				ans[i+1][j] = ord[at];
				if(mat[i+1][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					if(at == k) break;
				}
			}
		}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cout << (ans[i][j] == '-' ? ord[k-1] : ans[i][j]);
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c;
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(needs && !q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if(valid(nx, ny) && ans[nx][ny]) {
				q.push({nx, ny});
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

void bfs2(int i, int j, char c) {
	queue<pair<int, int>> q;
	q.push({i, j});
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				ans[nx][ny] = c;
				q.push({nx, ny});
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int c = '0'; c <= '9'; c++)
		ord.push_back(c);
	for(int c = 'a'; c <= 'z'; c++)
		ord.push_back(c);
	for(int c = 'A'; c <= 'Z'; c++)
		ord.push_back(c);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k || mat[i][j] != 'R') continue;
				if(ans[i][j] == '-') {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}

		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] != '-') {
					bfs2(i, j, ans[i][j]);
				}
			}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c;
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(needs && !q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				q.push({nx, ny});
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

void bfs2(int i, int j, char ch) {
	queue<pair<int, int>> q;
	q.push({i, j});
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				ans[nx][ny] = ch;
				q.push({nx, ny});
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k || mat[i][j] != 'R') continue;
				if(ans[i][j] == '-') {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}

		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] != '-') {
					bfs2(i, j, ans[i][j]);
				}
			}

		assert(at == k);
		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				assert(ans[i][j] != '-');
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c;
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(needs && !q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				q.push({nx, ny});
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

void bfs2(int i, int j, char ch) {
	queue<pair<int, int>> q;
	q.push({i, j});
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				ans[nx][ny] = ch;
				q.push({nx, ny});
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, sum = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k || mat[i][j] != 'R') continue;
				if(ans[i][j] == '-') {
					if(at < cnt%k) {
						sum += get+1;
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						sum += get;
						bfs(i, j, at, get);
						at++;
					}
				}
			}

		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] != '-') {
					bfs2(i, j, ans[i][j]);
				}
			}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, cur = 0;
		for(int i = 0; i < r; i += 2) {
			for(int j = 0; j < c; j++) {
				ans[i][j] = ord[at];
				if(mat[i][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					at = max(at, k-1);
				}
			}
			if(i+1 == r) break;
			for(int j = c-1; j >= 0; j--) {
				ans[i+1][j] = ord[at];
				if(mat[i+1][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					at = max(at, k-1);
				}
			}
		}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++)
				cout << ans[i][j];
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c;
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(needs && !q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				q.push({nx, ny});
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

void bfs2(int i, int j, char ch) {
	queue<pair<int, int>> q;
	q.push({i, j});
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				ans[nx][ny] = ch;
				q.push({nx, ny});
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, sum = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k || mat[i][j] != 'R') continue;
				if(ans[i][j] == '-') {
					if(at < cnt%k) {
						sum += get+1;
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						sum += get;
						bfs(i, j, at, get);
						at++;
					}
				}
			}

		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] != '-') {
					bfs2(i, j, ans[i][j]);
				}
			}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cout << ans[i][j];
			}
			cout << endl;
		}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, cur = 0;
		for(int i = 0; i < r; i += 2) {
			for(int j = 0; j < c; j++) {
				ans[i][j] = ord[at];
				if(mat[i][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
				}
			}
			if(i+1 == r) break;
			for(int j = c-1; j >= 0; j--) {
				ans[i+1][j] = ord[at];
				if(mat[i+1][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
				}
			}
		}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++)
				cout << ans[i][j];
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c;
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(needs && !q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				q.push({nx, ny});
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

void bfs2(int i, int j, char ch) {
	queue<pair<int, int>> q;
	q.push({i, j});
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int kk = 0; kk < 4; kk++) {
			int nx = x + dx[kk], ny = y + dy[kk];
			if(valid(nx, ny) && ans[nx][ny] == '-') {
				ans[nx][ny] = ch;
				q.push({nx, ny});
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k || mat[i][j] != 'R') continue;
				if(ans[i][j] == '-') {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}

		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] != '-') {
					bfs2(i, j, ans[i][j]);
				}
			}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				assert(ans[i][j] != '-');
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int vis[100][100];
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c && !vis[i][j];
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	vis[i][j] = 1;
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if(valid(nx, ny)) {
				q.push({nx, ny});
				vis[nx][ny] = 1;
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int c = '0'; c <= '9'; c++)
		ord.push_back(c);
	for(int c = 'a'; c <= 'z'; c++)
		ord.push_back(c);
	for(int c = 'A'; c <= 'Z'; c++)
		ord.push_back(c);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				vis[i][j] = 0;
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k) break;
				if(!vis[i][j]) {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] == '-') {
					ans[i][j] = ord[at-1];
				}
				cout << ans[i][j] << " \n"[j+1==c];
			}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, cur = 0;
		for(int i = 0; i < r; i += 2) {
			if(at == k) break;
			for(int j = 0; j < c; j++) {
				ans[i][j] = ord[at];
				if(mat[i][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					if(at == k) break;
				}
			}
			if(i+1 == r || at == k) break;
			for(int j = c-1; j >= 0; j--) {
				ans[i+1][j] = ord[at];
				if(mat[i+1][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					if(at == k) break;
				}
			}
		}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cout << (ans[i][j] == '-' ? ord[k-1] : ans[i][j]);
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[120][120], ans[120][120];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
vector<char> ord;

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int ch = '0'; ch <= '9'; ch++)
		ord.push_back(ch);
	for(int ch = 'a'; ch <= 'z'; ch++)
		ord.push_back(ch);
	for(int ch = 'A'; ch <= 'Z'; ch++)
		ord.push_back(ch);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0, cur = 0;
		for(int i = 0; i < r; i += 2) {
			for(int j = 0; j < c; j++) {
				ans[i][j] = ord[at];
				if(mat[i][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					if(at == k) break;
				}
			}
			if(i+1 == r || at == k) break;
			for(int j = c-1; j >= 0; j--) {
				ans[i+1][j] = ord[at];
				if(mat[i+1][j] == 'R') cur++;
				if((at < cnt%k && cur == get+1) || (at >= cnt%k && cur == get)) {
					cur = 0;
					at++;
					if(at == k) break;
				}
			}
		}

		for(int i = 0; i < r; i++) {
			for(int j = 0; j < c; j++) {
				cout << (ans[i][j] == '-' ? ord[k-1] : ans[i][j]);
			}
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int vis[100][100];
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c && !vis[i][j];
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	vis[i][j] = 1;
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if(valid(nx, ny)) {
				q.push({nx, ny});
				vis[nx][ny] = 1;
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int c = '0'; c <= '9'; c++)
		ord.push_back(c);
	for(int c = 'a'; c <= 'z'; c++)
		ord.push_back(c);
	for(int c = 'A'; c <= 'Z'; c++)
		ord.push_back(c);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				vis[i][j] = 0;
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k) break;
				if(!vis[i][j]) {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] == '-') {
					ans[i][j] = ord[at-1];
				}
				cout << ans[i][j];
				if(j == c-1) cout << endl;
			}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int r, c, k;
char mat[100][100], ans[100][100];
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
int vis[100][100];
vector<char> ord;

bool valid(int i, int j) {
	return i >= 0 && i < r && j >= 0 && j < c && !vis[i][j];
}

void bfs(int i, int j, int at, int needs) {
	queue<pair<int, int>> q;
	q.push({i, j});
	vis[i][j] = 1;
	ans[i][j] = ord[at];
	if(mat[i][j] == 'R') needs--;
	while(!q.empty()) {
		auto now = q.front();
		q.pop();
		int x = now.first, y = now.second;
		for(int i = 0; i < 4; i++) {
			int nx = x + dx[i], ny = y + dy[i];
			if(valid(nx, ny)) {
				q.push({nx, ny});
				vis[nx][ny] = 1;
				ans[nx][ny] = ord[at];
				if(mat[nx][ny] == 'R') needs--;
				if(needs == 0) return;
			}
		}
	}
}

int main() {
	ios::sync_with_stdio(0), cin.tie(0);
	for(int c = '0'; c <= '9'; c++)
		ord.push_back(c);
	for(int c = 'a'; c <= 'z'; c++)
		ord.push_back(c);
	for(int c = 'A'; c <= 'Z'; c++)
		ord.push_back(c);
	assert(ord.size() == 62);
	int t;
	cin >> t;
	while(t--) {
		cin >> r >> c >> k;
		int cnt = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				vis[i][j] = 0;
				ans[i][j] = '-';
				cin >> mat[i][j];
				cnt += mat[i][j] == 'R';
			}
		int get = cnt/k, at = 0;
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(at == k || mat[i][j] != 'R') continue;
				if(!vis[i][j]) {
					if(at < cnt%k) {
						bfs(i, j, at, get+1);
						at++;
					}
					else {
						bfs(i, j, at, get);
						at++;
					}
				}
			}
		for(int i = 0; i < r; i++)
			for(int j = 0; j < c; j++) {
				if(ans[i][j] == '-') {
					if(i) ans[i][j] = ans[i-1][j];
					else if(j) ans[i][j] = ans[i][j-1];
				}
				cout << ans[i][j];
				if(j == c-1) cout << endl;
			}
	}
	return 0;
}