#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<char> v;
  for (char c = 'A'; c <= 'Z'; c++) {
    v.push_back(c);
  }
  for (char c = 'a'; c <= 'z'; c++) {
    v.push_back(c);
  }
  for (int i = 0; i <= 9; i++) {
    v.push_back(i + '0');
  }
  int t;
  cin >> t;
  while (t--) {
    int r, c, k;
    cin >> r >> c >> k;
    char arr[r + 5][c + 5];
    int cnt = 0;
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        cin >> arr[i][j];
        if (arr[i][j] == 'R') {
          cnt++;
        }
      }
    }
    int avg = cnt / k;
    int remain = cnt % k;
    int num = 1, count = 0;
    char ans[r + 5][c + 5];
    for (int i = 1; i <= r; i++) {
      if (i % 2 != 0) {
        for (int j = 1; j <= c; j++) {
          ans[i][j] = v[num - 1];
          if (arr[i][j] == 'R') {
            count++;
          }
          if (count == avg) {
            if (remain == 0) {
              count = 0;
              if (num != k) {
                num++;
              }
            }
          } else if (count == avg + 1) {
            remain--;
            count = 0;
            if (num != k) {
              num++;
            }
          }
        }
      } else {
        for (int j = c; j >= 1; j--) {
          ans[i][j] = v[num - 1];
          if (arr[i][j] == 'R') {
            count++;
          }
          if (count == avg) {
            if (remain == 0) {
              count = 0;
              if (num != k) {
                num++;
              }
            }
          } else if (count == avg + 1) {
            remain--;
            count = 0;
            if (num != k) {
              num++;
            }
          }
        }
      }
    }
    for (int i = 1; i <= r; i++) {
      for (int j = 1; j <= c; j++) {
        cout << ans[i][j];
      }
      cout << endl;
    }
  }
}
