#include <bits/stdc++.h>
using namespace std;
int main() {
  string st = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  int t;
  cin >> t;
  while (t--) {
    int r, c, k;
    cin >> r >> c >> k;
    string s[r];
    int sm = 0;
    for (int i = 0; i < r; ++i) {
      cin >> s[i];
      for (int j = 0; j < s[i].length(); ++j)
        if (s[i][j] == 'R') ++sm;
    }
    int h = sm % k;
    int h1 = sm / k + 1;
    int cn = 0;
    int cnt = 0;
    int fl = 0;
    int f1 = 1;
    string s1 = "";
    for (int i = 0; i < r; ++i) {
      if (fl == 0) {
        for (int j = 0; j < s[i].length(); ++j) {
          if (cn == k) {
            cout << st[cn - 1];
          } else {
            if (h == 0 && f1 == 1) {
              --h1;
              f1 = 0;
            }
            if (cnt == h1) {
              cnt = 0;
              ++cn;
              --h;
            }
            if (s[i][j] == 'R') {
              ++cnt;
            }
            if (cn == k)
              cout << st[cn - 1];
            else
              cout << st[cn];
          }
        }
        cout << endl;
        fl = 1;
      } else {
        s1 = "";
        for (int j = s[i].length() - 1; j >= 0; --j) {
          if (cn == k) {
            s1 += st[cn - 1];
          } else {
            if (h == 0 && f1 == 1) {
              --h1;
              f1 = 0;
            }
            if (cnt == h1) {
              cnt = 0;
              ++cn;
              --h;
            }
            if (s[i][j] == 'R') {
              ++cnt;
            }
            if (cn == k)
              s1 += st[cn - 1];
            else
              s1 += st[cn];
          }
        }
        for (int k = s1.length() - 1; k >= 0; --k) cout << s1[k];
        cout << endl;
        fl = 0;
      }
    }
  }
}
