#include <bits/stdc++.h>
using namespace std;
int a[105][105];
char b[105][105];
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int r, c, k;
    cin >> r >> c >> k;
    int count1 = 0;
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        char c;
        cin >> c;
        if (c == 'R') {
          a[i][j] = 1;
          count1++;
        } else if (c == '.')
          a[i][j] = 0;
      }
    }
    int x = count1 / k + 1;
    int y = count1 % k;
    int flag1 = 0, flag2 = 0, flag3 = 0;
    char cc = '0';
    for (int i = 1; i <= r; i++) {
      if (i % 2 == 1) {
        for (int j = 1; j <= c; j++) {
          if (a[i][j] == 1) {
            if (flag2 >= y) {
              x = x - 1;
              flag2 = -999999;
            }
            flag1++;
            if (flag1 > x) {
              flag1 = 1;
              flag2++;
              cc = char(cc + 1);
              if (cc == '9' + 1) cc = 'A';
              if (cc == 'Z' + 1) cc = 'a';
            }
            b[i][j] = cc;
          } else {
            b[i][j] = cc;
          }
        }
      } else {
        for (int j = c; j >= 1; j--) {
          if (a[i][j] == 1) {
            if (flag2 >= y) {
              x = x - 1;
              flag2 = -999999;
            }
            flag1++;
            if (flag1 > x) {
              flag1 = 1;
              flag2++;
              cc = char(cc + 1);
              if (cc == '9' + 1) cc = 'A';
              if (cc == 'Z' + 1) cc = 'a';
            }
            b[i][j] = cc;
          } else {
            b[i][j] = cc;
          }
        }
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        cout << b[i][j];
      }
      cout << endl;
    }
  }
}
