#include <bits/stdc++.h>
using namespace std;
int t, n, m, k, a[105][105], h, a1, a2, cnt, ans[105][105], pos, ch;
char c[105][105];
string s;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> t;
  while (t--) {
    h = 0;
    pos = 0;
    cin >> n >> m >> k;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> c[i][j];
        if (c[i][j] == 'R') {
          a[i][j] = 1;
          h++;
        } else {
          a[i][j] = 0;
        }
      }
    }
    a1 = h % k;
    a2 = k - h % k;
    cnt = 0;
    ch = 0;
    for (int i = 0; i < n; i++) {
      if (i % 2 == 0) {
        for (int j = 0; j < m; j++) {
          if (ch) {
            if (a[i][j] == 0) {
              ans[i][j] = pos;
            } else {
              pos++;
              ans[i][j] = pos;
              cnt++;
              ch = 0;
            }
            if (a1 == 0) {
              if (cnt == h / k) {
                ch = 1;
                cnt = 0;
              }
            }
          } else {
            if (a[i][j]) {
              cnt++;
            }
            ans[i][j] = pos;
            if (a1 > 0) {
              if (cnt == h / k + 1) {
                cnt = 0;
                ch = 1;
                a1--;
              }
            } else {
              if (cnt == h / k) {
                cnt = 0;
                ch = 1;
              }
            }
          }
        }
      } else {
        for (int j = m - 1; j >= 0; j--) {
          if (ch) {
            if (a[i][j] == 0) {
              ans[i][j] = pos;
            } else {
              pos++;
              ans[i][j] = pos;
              cnt++;
              ch = 0;
            }
            if (a1 == 0) {
              if (cnt == h / k) {
                ch = 1;
                cnt = 0;
              }
            }
          } else {
            if (a[i][j]) {
              cnt++;
            }
            ans[i][j] = pos;
            if (a1 > 0) {
              if (cnt == h / k + 1) {
                cnt = 0;
                a1--;
                ch = 1;
              }
            } else {
              if (cnt == h / k) {
                cnt = 0;
                ch = 1;
              }
            }
          }
        }
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (ans[i][j] <= 9) {
          cout << ans[i][j];
        } else if (ans[i][j] <= 35) {
          char cc = ans[i][j] - 10 + 'a';
          cout << cc;
        } else {
          char cc = ans[i][j] - 36 + 'A';
          cout << cc;
        }
      }
      cout << '\n';
    }
  }
}
