#include <bits/stdc++.h>
using namespace std;
char use[62] = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'a', 'b', 'c',
                'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
                'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C',
                'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
                'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int r, c, k;
    int now = 0;
    scanf("%d %d %d", &r, &c, &k);
    char mp[102][102];
    char ans[102][102];
    for (int i = 0; i < r; i++) {
      scanf("%s", mp[i]);
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        if (mp[i][j] == 'R') now++;
      }
    }
    int hehe = now / k;
    int res = now % k;
    int cnt = 0;
    int ct = 0;
    int cr = 1;
    for (int i = 0; i < r; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < c; j++) {
          if (mp[i][j] == 'R') {
            if (cr <= res) {
              ct++;
              ans[i][j] = use[cnt];
              if (ct == hehe + 1) {
                cr++;
                ct = 0;
                cnt++;
              }
            } else {
              ct++;
              ans[i][j] = use[cnt];
              if (ct == hehe) {
                ct = 0;
                cnt++;
              }
            }
          } else {
            if (cnt >= k)
              ans[i][j] = use[cnt - 1];
            else
              ans[i][j] = use[cnt];
          }
        }
      } else {
        for (int j = c - 1; j >= 0; j--) {
          if (mp[i][j] == 'R') {
            if (cr <= res) {
              ct++;
              ans[i][j] = use[cnt];
              if (ct == hehe + 1) {
                cr++;
                ct = 0;
                cnt++;
              }
            } else {
              ct++;
              ans[i][j] = use[cnt];
              if (ct == hehe) {
                ct = 0;
                cnt++;
              }
            }
          } else {
            if (cnt >= k)
              ans[i][j] = use[cnt - 1];
            else
              ans[i][j] = use[cnt];
          }
        }
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < c; j++) {
        printf("%c", ans[i][j]);
      }
      printf("\n");
    }
  }
  return 0;
}
