#include <bits/stdc++.h>   using namespace std;   const int N = 1e5 + 5;   char a[65];   void pre() {     int j = 1;     for (j = 1; j <= 10; j++) a[j - 1] = (char)(j - 1 + 48);     for (int i = 0; i < 26; i++) a[j++] = (char)(i + 97);     for (int i = 0; i < 26; i++) a[j++] = (char)(i + 65);     a[10] =  Z ;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     pre();     int T;     cin >> T;     while (T--) {       vector<int> val(65, 0);       int r, c, k;       cin >> r >> c >> k;       string s[r], ans[r];       int R = 0;       for (int i = 0; i < r; i++) {         cin >> s[i];         for (int j = 0; j < s[i].size(); j++) {           if (s[i][j] ==  R ) R++;           ans[i] +=  . ;         }       }       int x = R / k;       R = R % k;       for (int i = 0; i < k; i++) {         val[i] = x;         if (R) {           R--;           val[i]++;         }       }       int gg = 0;       for (int i = 0; i < r; i++) {         if (i % 2 == 0) {           for (int j = 0; j < c; j++) {             ans[i][j] = a[gg];             if (s[i][j] ==  R ) {               val[gg]--;               if (!val[gg]) {                 gg++;               }             }             if (gg >= k - 1) gg = k - 1;           }         } else {           for (int j = c - 1; j >= 0; j--) {             ans[i][j] = a[gg];             if (s[i][j] ==  R ) {               val[gg]--;               if (!val[gg]) {                 gg++;               }             }             if (gg >= k - 1) gg = k - 1;           }         }       }       for (int i = 0; i < r; i++) cout << ans[i] <<   n ;     }     return 0;   }   