#include <bits/stdc++.h>   using namespace std;   const int N = 100005;   int n, m, K, w[N];   inline char nc() {     static char buf[100000], *p1 = buf, *p2 = buf;     if (p1 == p2) {       p2 = (p1 = buf) + fread(buf, 1, 100000, stdin);       if (p1 == p2) return EOF;     }     return *p1++;   }   inline void read(int& x) {     char tr = nc(), b = 1;     for (; tr <  0  || tr >  9 ; tr = nc())       if (tr ==  - ) b = -1;     for (x = 0; tr >=  0  && tr <=  9 ;          x = (x << 3) + (x << 1) + tr - 48, tr = nc())       ;     x *= b;   }   inline int count() {     int ret = 0, x;     for (int i = 0; i < n - 1; i++)       for (int j = 0; j < m - 1; j++)         x = i * m + j, ret += (w[x] & w[x + m] & w[x + 1]) +                               (w[x + m + 1] & w[x + m] & w[x + 1]) +                               (w[x] & w[x + m] & w[x + m + 1]) +                               (w[x] & w[x + 1] & w[x + m + 1]);     return ret;   }   int Q[N], l, r, ins[N];   const int dx[6] = {0, 0, 1, -1};   const int dy[6] = {1, -1, 0, 0};   inline int pd() {     l = r = -1;     for (int i = 0; i < n * m; i++) ins[i] = 0;     for (int i = 0; i < n * m; i++)       if (w[i]) {         Q[++r] = i;         break;       }     while (l < r) {       ++l;       int x = Q[l] / m, y = Q[l] % m;       for (int k = 0; k < 4; k++) {         int sx = x + dx[k], sy = y + dy[k];         if (sx < 0 || sy < 0 || sx >= n || sy >= m || ins[sx * m + sy] ||             !w[sx * m + sy])           continue;         Q[++r] = sx * m + sy;         ins[sx * m + sy] = 1;       }     }     for (int i = 0; i < n * m; i++)       if (w[i] && !ins[i]) return 0;     return 1;   }   inline int check(int mid) {     for (int i = 0; i < n * m; i++) w[i] = (i <= mid);     return count();   }   inline int Solve() {     int C = 4 * (n - 1) * (m - 1), L = -1, R = n * m, MID;     if (K > C) return 0;     if (n == 3 || m == 3) {       if (K == C - 1 || K == C - 2 || K == C - 4 || K == C - 5) return 0;     } else {       if (K == C - 1 || K == C - 2 || K == C - 4 || K == C - 5 || K == C - 8)         return 0;     }     while (L + 1 < R)       if (check(MID = (L + R) >> 1) >= K)         R = MID;       else         L = MID;     int cur = check(R);     if (cur == K) return 1;     vector<int> bl, em;     for (int i = 0; i < n * m; i++)       if (min(i / m, abs(i / m - R / m)) <= 1)         w[i] ? bl.push_back(i) : em.push_back(i);     int x, p;     while (cur != K) {       if (cur < K) {         x = em[p = rand() % ((int)em.size())];         w[x] = 1;         if (!pd()) {           w[x] = 0;           continue;         }         em.erase(em.begin() + p);         bl.push_back(x);         cur = count();       } else {         x = bl[p = rand() % ((int)bl.size())];         w[x] = 0;         if (!pd()) {           w[x] = 1;           continue;         }         bl.erase(bl.begin() + p);         em.push_back(x);         cur = count();       }     }     return 1;   }   int main() {     int T;     read(T);     while (T--) {       read(n);       read(m);       read(K);       int flag = 0;       if (n < m) swap(n, m), flag = 1;       if (Solve()) {         if (!flag) {           for (int i = 0; i < n; i++, putchar(  n ))             for (int j = 0; j < m; j++) putchar(w[i * m + j] ?  *  :  . );         } else {           for (int j = 0; j < m; j++, putchar(  n ))             for (int i = 0; i < n; i++) putchar(w[i * m + j] ?  *  :  . );         }         putchar(  n );       } else         printf( -1 n n );     }     return 0;   }