#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=1;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    bool iv=0;
    if(n<5&&m<5)
    {
        if(!hasans[n][m][K])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar(i+j==2?'*':'.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(n>m)swap(n,m),iv=1;
    if(n==3&&m>=5&&K==8*(m-2))
    {
        if(!iv)
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        else
        for(int i=1;i<=m;i++)
        {
            for(int j=1;j<=n;j++)putchar(i==1?'.':'*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else if(fy==2)flag[fx+1][1]=1,flag[fx][m-1]=1;
                    else flag[fx][3]=1,flag[fx][m]=1;
                }
                goto output;
            }
            else if(K<4||(i==n&&fy==m-4))
            {
                for(int k=0;k<16;k++)
                {
                    for(int l=0;l<4;l++)flag[i][m-l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    if(!iv)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    else
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            putchar(flag[j][i]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include<bits/stdc++.h>
typedef long long ll;
#define Block '*'
#define Empty '.'
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
std::vector<std::string>ans;
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int t=gi();
	while(t--){
		int n=gi(),m=gi(),swp=0;ll k=gi();
		if(n==3)swp=1,std::swap(n,m);
		ans=std::vector<std::string>(n,std::string(m,Empty));
		ans[0]=std::string(m,Block);
		bool nosol=0;
		for(int i=1;k&&i<n;++i)
			for(int j=0;k&&j<m;++j){
				int s=!j?1:3+(j<m-1);
				if(k>=s)k-=s,ans[i][j]=Block;
				else{
					if(j==m-1){
						if(i==n-1)nosol=1;
						else ans[i+1][m-2]=Block,ans[i+1][m-1]=(k==2?Block:Empty);
					}else if(k==1)ans[i][m-1]=Block;
					else if(j==m-2){
						if(i==n-1)nosol=1;
						else if(j==1){
							ans[i+1][0]=ans[i+1][1]=Block,ans[i][m-1]=Block;
							if(k==3)ans[i+1][m-1]=ans[i+1][m-2]=Block;
						}else ans[i+1][m-2]=ans[i+1][m-3]=Block,ans[i][m-1]=(k==3?Block:Empty);
					}else if(k==2)ans[i][m-2]=Block;
					else if(j==m-3){
						if(i==n-1)nosol=1;
						else ans[i][m-2]=ans[i+1][m-2]=ans[i+1][m-1]=Block;
					}else ans[i][m-1]=ans[i][m-3]=Block;
					k=0;
				}
			}
		if(nosol||k)puts("-1");
		else{
			if(swp)std::swap(n,m);
			for(int i=0;i<n;++i){for(int j=0;j<m;++j)putchar(swp?ans[j][i]:ans[i][j]);puts("");}
		}
		if(t)puts("");
	}
	return 0;
}

#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define pob pop_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0,c=getchar(),f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
int n,m,k,a[100005][500];
int main()
{
	for(int test=read();test--;)
	{
		n=read(),m=read(),k=read();
		bool flag=0;
		if(n<m)swap(n,m),flag=1;
		For(i,1,m)
		{
			For(x,0,n+1)For(y,0,m+1)a[x][y]=0;
			int cnt=0;
			For(y,1,i)a[1][y]=1;
			For(x,2,n)For(y,1,m)
			{
				int ad=a[x-1][y]*a[x][y-1]+a[x-1][y-1]*a[x][y-1]+a[x-1][y]*(a[x-1][y-1]+a[x-1][y+1]);
				if(cnt+ad<=k&&(a[x-1][y]||a[x][y-1]))cnt+=ad,a[x][y]=1;
			}
			if(cnt==k)goto YES;
		}
		puts("-1\n");continue;
		YES:;
		if(flag)
			For(y,1,m)
			{
				For(x,1,n)putchar(a[x][y]?'*':'.');
				puts("");
			}
		else
			For(x,1,n)
			{
				For(y,1,m)putchar(a[x][y]?'*':'.');
				puts("");
			}
		puts("");
	}
}
//hellobig_tq//hello

#include <bits/stdc++.h>

using namespace std;
int main() {
	int T;
	cin >> T;
	bool sheep=false;
	while (T--) {
		if (sheep)
			cout << endl;
		else
			sheep = true;
		int n,m,k;
		cin >> n >> m >> k;
		int max = 4*(n-1)*(m-1);
		int gap = max-k;
		if (k>4*(n-1)*(m-1)) {
			cout << -1 << endl;
			continue;
		}
		if (k==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==0 and j==0)
						cout << "*";
					else
						cout << ".";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==1 or gap==2 or gap==4 or gap==5) {
			cout << -1 << endl;
			continue;
		}
		if (gap==3) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-1 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==6) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==7) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if ((i==n-2 or i==n-1) and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==8) {
			if (m>3 and n>3) {
				cout << -1 << endl;
				continue;
			}
			else {
				if (m==3)
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (i==n-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
				else
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (j==m-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
			}
			continue;
		}
		if (gap==12) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-2)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		bool a[n][m];
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				a[i][j] = false;
			}
		}
		for (int i=0; i<m-1; i++) {
			a[1][i] = true;
		}
		int maxOne = 4*((m-2)*(n-2)-1)+1+3;
		int maxTwo = maxOne + 4*((m-4)*(m>3)+(n-4)*(n>3))+(m>3)+(n>3);
		int maxThree = maxTwo + 3;
		int maxFour = maxThree + 3*(m>3);
		if (k<=maxOne) {
			int squares = (k-1)/4;
			int residue = (k-1)%4;
			int s=0;
			while (squares--) {
				a[s/(m-2)+2][m-s%(m-2)-3] = true;
				s++;
			}
			for (int i=1; i<n-1; i++) {
				if (a[i][0])
					a[i+1][m-2]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
		} else if (k<=maxTwo) {
			int residue = (k-(m>3)-(n>3)-1)%4;
			int bonusSquares = (k-maxOne+3-(m>3)-(n>3))/4;
			int ii = n-2;
			int jj = 1;
			while (bonusSquares--) {
				if (jj<m-3) {
					a[0][jj]=true;
					jj++;
				} else if (ii>2) {
					a[ii][m-1]=true;
					ii--;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					if (i!=n-1 or j!=0)
						a[i][j]=true;
				}
			}
		} else if (k<=maxThree) {
			a[n-1][0]=true;
			int residue = (k-maxTwo)%4;
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
		} else if (k<=maxFour) {
			a[0][m-3]=true;
			int gapFour = k-maxThree-1;
			if (gapFour>0)
				a[1][m-1]=true;
			if (gapFour>1)
				a[0][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		} else if (k<=(maxFour+3)) {
			a[0][m-3]=true;
			a[0][m-2]=true;
			int gapFive = k-maxFour-1;
			if (gapFive==1)
				a[0][m-1]=true;
			else if (gapFive==2)
				a[1][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		}
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				if (a[i][j])
					cout << "*";
				else
					cout << ".";
			}
			cout << endl;
		}
	}

	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int n,m,k;
vvi a;
int cur;
bool add(int x, int y) {
    if(x==0) {
        a[x][y] = 1;
        return true;
    }
    if(y == 0) {
        if(a[x-1][0] + a[x-1][1] == 2) cur++;
        a[x][y] = 1;
        return true;
    }
    int inc = 0;
    if(a[x-1][y] + a[x-1][y-1] == 2) inc++;
    if(a[x][y-1] + a[x-1][y-1] == 2) inc++;
    if(a[x-1][y] + a[x][y-1] == 2) inc++;
    if(y < m-1 && a[x-1][y] + a[x-1][y+1] == 2) inc++;
    if(inc == 0) {
        if(a[x][y-1] == 0 && a[x-1][y] == 0 && y == m-1) return false;
    }
    if(cur+inc <= k) {
        cur+=inc;
        a[x][y] = 1;
        return true;
    }
    else return false;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
    int t;
    cin>>t;
    forn(aff,0,t) {

        cin>>n>>m>>k;
        cur = 0;
        a=vvi(n,vi(m,0));
        int best = (n-1)*(m-1)*4;
        if(k>best || k==best -1 || k==best -2 || k==best-5 || k==best-4) {
            printf("-1\n");
            if(aff<t-1) printf("\n");
            continue;
        }
        if(k==best  - 8) {
            if(m>3 && n>3) {
                printf("-1\n");
                if(aff<t-1) printf("\n");
                continue;
            }
            forn(i,0,n) forn(j,0,m) {
                a[i][j] = 1;
            }
            if(n == 3) {
                forn(i,0,3) a[i][0] = 0;
            }
            else if(m == 3) {
                forn(i,0,3) a[0][i] = 0;
            }
            forn(i,0,n) {
                forn(j,0,m) {
                    if(a[i][j]) printf("*");
                    else printf(".");
                }
                printf("\n");
            }
            if(aff<t-1) printf("\n");
            continue;
        }
        bool f = false;
        forn(i,0,n) {
            if(cur == k) break;
            forn(j,0,m) {
                add(i,j);
                if(cur==k) break;
            }
        }
        if(k==0) add(0,0);
        if(cur<k) {
            if(a[n-2][m-1] == 0) {
                a[n-1][0]=0;
                a[n-1][1]=1;
                a[n-1][2]=1;
                cur = k;
            }
        }
        if(cur<k) {
            printf("-1\n");
            if(aff<t-1) printf("\n");
            continue;
        }
        forn(i,0,n) {
            forn(j,0,m) {
                if(a[i][j]) printf("*");
                else printf(".");
            }
            printf("\n");
        }
        if(aff<t-1) printf("\n");

    }
}

#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int h,w,n,want;
bool haveret; char ret[MAXN+1],nret[MAXN+1];

void bf() {
	FOR(msk,1,1<<n) {
		int cur=0;
		REP(x,h-1) REP(y,w-1) {
			int cnt=0;
			REP(dx,2) REP(dy,2) if((msk>>((x+dx)*w+(y+dy)))&1) ++cnt;
			if(cnt==3) ++cur; if(cnt==4) cur+=4;
		}
		if(cur==want) { haveret=true; REP(j,n) ret[j]=(msk>>j)&1?'*':'.'; return; }
	}
}

void greedy() { // w>=5
	if(h==2&&want==(w-2)*4) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=0<=y&&y<w-1?'*':'.'; return; }
	if(h==2&&want==(w-3)*4) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=1<=y&&y<w-1?'*':'.'; return; }
	if(h==3&&want==(w-2)*8) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=0<=y&&y<w-1?'*':'.'; return; }

	int left=want; REP(x,h) REP(y,w) ret[x*w+y]=x==0?'*':'.';
	int x,y;
	for(x=1;x<h;++x) {
		for(y=0;y<w;++y) {
			if(left<=3||x==h-1&&w-y==4) break;
			ret[x*w+y]='*'; left-=y==0?1:y==w-1?3:4;
		}
		if(left<=3||x==h-1&&w-y==4) break;
	}
	if(x==h-1&&w-y==4) {
		REP(msk,1<<4) {
			int cur=0;
			REP(yy,4) {
				int cnt=0;
				REP(dy,2) if(yy+dy==0||(msk>>(yy+dy-1)&1)) ++cnt;
				if(cnt==1) ++cur; if(cnt==2) cur+=4;
			}
			if(cur-1==left) { haveret=true; REP(j,4) ret[x*w+y+j]=(msk>>j)&1?'*':'.'; return; }
		}
	}
	if(left<=3) {
		int dy=w-y; //printf("left=%d dy=%d\n",left,dy);
		int y1=dy==2||dy>=4?w-1:0;
		int y2=dy==3?w-2:dy>=4?w-3:dy==2?1:2;
		if(left&1) ret[(x+(y1<y?1:0))*w+y1]='*';
		if(left&2) ret[(x+(y2<y?1:0))*w+y2]='*';
		haveret=true;
	}
}

void run() {
	scanf("%d%d%d",&h,&w,&want); n=h*w; haveret=false;
	if(h<=4&&w<=4) {
		bf();
	} else {
		bool swp=w<h;
		if(swp) swap(w,h);
		greedy();
		if(swp) { swap(w,h); REP(x,h) REP(y,w) nret[x*w+y]=ret[y*h+x]; REP(i,n) ret[i]=nret[i]; }
	}
	if(!haveret) printf("-1\n"); else REP(x,h) { REP(y,w) printf("%c",ret[x*w+y]); puts(""); }
}

int main() {
	int n; scanf("%d",&n); FORE(i,1,n) { if(i!=1) puts(""); run(); }
	return 0;
}

//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n, m, p;

void doprint(vector<vector<int>> &a, int swapy)
{
	if(!swapy)
	{
		for(auto e : a)
		{
			for(auto f : e) printf("%c", f?'*':'.');
			printf("\n");
		}
	}
	else
	{
		for(int i=0;i<a[0].size();i++)
		{
			for(int j=0;j<a.size();j++)
			{
				printf("%c", a[j][i]?'*':'.');
			}
			printf("\n");
		}
	}
}

int dodo()
{
	int i, j, k, l;
	cin>>n>>m>>p;
	vector<vector<int>> a;
	a.resize(n);
	for(i=0;i<n;i++) a[i].resize(m);
	if(p == 0)
	{
		a[0][0]=1;
		doprint(a, 0);
		return 0;
	}
	if(n <= 4 && m <= 4)
	{
		for(i=1;i<(1<<n*m);i++)
		{
			for(j=0;j<n*m;j++) a[j/m][j%m]=!!(i&(1<<j));
			int cnt=0;
			for(j=0;j<n-1;j++) for(k=0;k<m-1;k++)
			{
				int u=a[j][k]+a[j][k+1]+a[j+1][k]+a[j+1][k+1];
				if(u == 3) cnt++;
				else if(u == 4) cnt+=4;
			}
			if(cnt == p)
			{
				for(j=0;j<n;j++)
				{
					for(k=0;k<m;k++) printf("%c", a[j][k]?'*':'.');
					printf("\n");
				}
				return 0;
			}
		}
		return !printf("-1\n");
	}

	int swapy=0;
	if(m <= 4) swap(n, m), swapy=1;
	a.resize(n);
	for(i=0;i<n;i++) a[i].resize(m);
	if(n == 3 && p == 4*(n-1)*(m-1)-8)
	{
        for(i=1;i<m;i++) for(j=0;j<3;j++) a[j][i]=1;
        doprint(a, swapy);
        return 0;
	}
    int now=0;
    for(i=0;i<m;i++) a[0][i]=1;
    for(i=1;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(i == n-1 && j == m-4) break;
			a[i][j]=1;
			if(j == 0) now++;
			else if(j == m-1) now+=3;
			else now+=4;
            if(p-now < 4)
			{
				if(i < n-1)
				{
					if(p-now == 0);
					else if(p-now == 1)
					{
						if(j >= 1) a[i+1][0]=1;
						else a[i][m-1]=1;
					}
					else if(p-now == 2)
					{
						if(j == 0) a[i][m-1]=a[i+1][0]=a[i+1][1]=1;
						else if(j == 1) a[i+1][0]=a[i][m-1]=1;
						else a[i+1][0]=a[i+1][j]=1;
					}
					else
					{
						if(j == 0) a[i+1][0]=a[i+1][1]=a[i][m-2]=1;
						else if(j == 1) a[i+1][0]=a[i][m-2]=1;
						else if(j == 2) a[i+1][1]=a[i][m-1]=1;
						else a[i+1][0]=a[i+1][j-1]=1;
					}
					doprint(a, swapy);
					return 0;
				}
				else
				{
					if(p-now == 0);
					else if(p-now == 1) a[i][m-1]=1;
					else if(p-now == 2) a[i][m-2]=1;
					else if(p-now == 3) a[i][m-3]=a[i][m-1]=1;
					doprint(a, swapy);
					return 0;
				}
			}
		}
	}
	map<int, string> mq;
	mq[0]="0000";
	mq[1]="0001";
	mq[2]="0010";
	mq[3]="0101";
	mq[4]="1000";
	mq[5]="1001";
	mq[6]="1010";
	mq[8]="1100";
	mq[9]="1101";
	mq[12]="1110";
	mq[15]="1111";
	if(mq.count(p-now))
	{
		for(i=0;i<4;i++) a[n-1][m-4+i]=mq[p-now][i]-'0';
		doprint(a, swapy);
	}
	else return !printf("-1\n");
}

int main()
{
	int i, j, k, l;
	int T;
	cin>>T;
	while(T--)
	{
		dodo();
		printf("\n");
	}
	return 0;
}
//*/

#include<bits/stdc++.h>

using namespace std;
void print(vector <vector <char> > a, bool flag)
{
	if(flag)
	{
		for(int j = 0; j < a[0].size(); j++)
		{
			for(int i = 0; i < a.size(); i++)
			{
				cout << a[i][j] << "";
			}
			cout << "\n";
		}
	}
	else
	{
		for(int i = 0; i < a.size(); i++)
		{
			for(int j = 0; j < a[i].size(); j++)
			{
				cout << a[i][j] << "";
			}
			cout << "\n";
		}
	}
	cout << "\n";
}
signed main(){
//	ios_base::sync_with_stdio(false);
//	cin.tie(NULL);
//	cout.tie(NULL);
	int t;
	cin >> t;
	while(t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		bool flag = 0;
		if(n < m)
		{
			swap(n, m);
			flag = 1;
		}
		bool found = 0;
		vector <vector <int> > a(n + 2, vector <int> (m + 2));
		for(int s = 1; s <= m; s++)
		{
			for(int i = 0; i <= n + 1; i++)
			{
				for(int j = 0; j <= m + 1; j++)
				{
					a[i][j] = 0;
				}
			}
			for(int i = 1; i <= s; i++)
			{
				a[1][i] = 1;
			}
			int cnt = 0;
			for(int i = 2; i <= n; i++)
			{
				for(int j = 1; j <= m; j++)
				{
					int add = a[i - 1][j] * (a[i - 1][j - 1] + a[i - 1][j + 1]) + a[i - 1][j] * a[i][j - 1] + a[i][j - 1] * a[i - 1][j - 1];
					if(cnt + add <= k && (a[i - 1][j] + a[i][j - 1]))
					{
						a[i][j] = 1;
						cnt += add;
					}
				}
			}
			if(cnt == k)
			{
				found = 1;
				break;
			}
		}
		if(!found)
		{
			cout << -1 << "\n\n";
		}
		else if(flag)
		{
			for(int j = 1; j <= m; j++)
			{
				for(int i = 1; i <= n; i++)
				{
				//	cout << a[i][j];
					if(a[i][j])
					{
						cout << "*";
					}
					else
					{
						cout << ".";
					}
				}
				cout << "\n";
			}
			cout << "\n";
		}
		else
		{
			for(int i = 1; i <= n; i++)
			{
				for(int j = 1; j <= m; j++)
				{
					if(a[i][j])
					{
						cout << "*";
					}
					else
					{
						cout << ".";
					}
				}
				cout << "\n";
			}
			cout << "\n";
		}
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=100005;
int w[N],q[N],vis[N];
int n,m,k,fl,qq[N];
bool connect(){
	int h=0,t=1,cnt=0;
	For(i,1,n*m) vis[i]=0;
	For(i,1,n*m) if (w[i]) q[1]=i,++cnt;
	vis[q[1]]=1;
	while (h!=t){
		int x=q[++h];
		if (x+m<=n&&w[x+m]&&!vis[x+m])
			vis[x+m]=1,q[++t]=x+m;
		if (x-m>=1&&w[x-m]&&!vis[x-m])
			vis[x-m]=1,q[++t]=x-m;
		if (x%m!=0&&w[x+1]&&!vis[x+1])
			vis[x+1]=1,q[++t]=x+1;
		if (x%m!=1&&w[x-1]&&!vis[x-1])
			vis[x-1]=1,q[++t]=x-1;
	}
	return cnt==t;
}
int count(){
	int ans=0;
	For(i,1,(n-1)*m) if (i%m){
		ans+=w[i]&w[i+1]&w[i+m];
		ans+=w[i]&w[i+1]&w[i+1+m];
		ans+=w[i]&w[i+m]&w[i+1+m];
		ans+=w[i+1]&w[i+m]&w[i+1+m];
	}
	return ans;
}
int check(int p){
	For(i,1,n*m) w[i]=(i<=p);
	return count();
}
bool work(){
	int c=4*(n-1)*(m-1);
	if (k>c||k==c-1||k==c-2||k==c-4||k==c-5) return 0;
	if (k==c-8&&n!=3&&m!=3) return 0;
	int l=0,r=n*m,ans=0;
	while (l<=r){
		int mid=(l+r)/2;
		if (check(mid)<=k)
			ans=mid,l=mid+1;
		else r=mid-1;
	}
	check(ans);
	int cur=count(),top=0;
	if (cur==k) return 1;
	For(i,1,n*m)
		if ((i-1)/m==0||abs((i-1)/m-(ans-1)/m)<=1)
			qq[++top]=i;
	for (;cur^k;){
		int at,x;
		if (cur<k){
			for (;;){
				at=rand()%top+1;
				if (!w[qq[at]]) break;
			}
			x=qq[at]; w[x]=1;
			if (!connect()){
				w[x]=0; continue;
			}
			cur=count();
		}
		else{
			for (;;){
				at=rand()%top+1;
				if (w[qq[at]]) break;
			}
			x=qq[at]; w[x]=0;
			if (!connect()){
				w[x]=1; continue;
			}
			cur=count();
		}
	}
	return 1;
}
void solve(){
	scanf("%d%d%d",&n,&m,&k);
	int fl=(n<m);
	if (fl) swap(n,m);
	if (!work()) puts("-1");
	else if (!fl){
		For(i,1,n){
			For(j,1,m) putchar(w[(i-1)*m+j]?'*':'.');
			puts("");
		}
	}
	else{
		For(i,1,m){
			For(j,1,n) putchar(w[(j-1)*m+i]?'*':'.');
			puts("");
		}
	}
	puts("");
}
int main(){
	srand(19*6*817);
	int T;
	scanf("%d",&T);
	while (T--) solve();
}

#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y)for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y)for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define pob pop_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int>pii;
typedef vector<int>vi;
inline int read()
{
int x=0,c=getchar(),f=0;
for(;c>'9'||c<'0';f=c=='-',c=getchar());
for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
return f?-x:x;
}
inline void write(int x)
{
if(x<0)putchar('-'),x=-x;
if(x>=10)write(x/10);
putchar(x%10+48);
}
int n,m,k,a[100005][500];
int main()
{
for(int test=read();test--;)
{
n=read(),m=read(),k=read();
bool flag=0;
if(n<m)swap(n,m),flag=1;
For(i,1,m)
{
For(x,0,n+1)For(y,0,m+1)a[x][y]=0;
int cnt=0;
For(y,1,i)a[1][y]=1;
For(x,2,n)For(y,1,m)
{
int ad=a[x-1][y]*a[x][y-1]+a[x-1][y-1]*a[x][y-1]+a[x-1][y]*(a[x-1][y-1]+a[x-1][y+1]);
if(cnt+ad<=k&&(a[x-1][y]||a[x][y-1]))cnt+=ad,a[x][y]=1;
}
if(cnt==k)goto YES;
}
puts("-1\n");continue;
YES:;
if(flag)
For(y,1,m)
{
For(x,1,n)putchar(a[x][y]?'*':'.');
puts("");
}
else
For(x,1,n)
{
For(y,1,m)putchar(a[x][y]?'*':'.');
puts("");
}
puts("");
}
}

#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define pob pop_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0,c=getchar(),f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
int n,m,k,a[100005][500];
int main()
{
	for(int test=read();test--;)
	{
		n=read(),m=read(),k=read();
		bool flag=0;
		if(n<m)swap(n,m),flag=1;
		For(i,1,m)
		{
			For(x,0,n+1)For(y,0,m+1)a[x][y]=0;
			int cnt=0;
			For(y,1,i)a[1][y]=1;
			For(x,2,n)For(y,1,m)
			{
				int ad=a[x-1][y]*a[x][y-1]+a[x-1][y-1]*a[x][y-1]+a[x-1][y]*(a[x-1][y-1]+a[x-1][y+1]);
				if(cnt+ad<=k&&(a[x-1][y]||a[x][y-1]))cnt+=ad,a[x][y]=1;
			}
			if(cnt==k)goto YES;
		}
		puts("-1\n");continue;
		YES:;
		if(flag)
			For(y,1,m)
			{
				For(x,1,n)putchar(a[x][y]?'*':'.');
				puts("");
			}
		else
			For(x,1,n)
			{
				For(y,1,m)putchar(a[x][y]?'*':'.');
				puts("");
			}
		puts("");
	}
}
//hellobig_tq

#include<bits/stdc++.h>

using namespace std;

int n,m,k;
vector<vector<int> > v;
bool transponer;

void escribe()
{
  if (transponer) {
    vector<vector<int> > nextv(m+2,vector<int> (n+2,0));
    for (int i=1;i<=n;i++)
      for (int j=1;j<=m;j++)
	nextv[j][i]=v[i][j];
    swap(n,m);
    v=nextv;
  }
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++)
      if (v[i][j]) cout<<"*";
      else cout<<".";
    cout<<endl;
  }
}

int valor(int i,int j)
{
  if (i==1) return 0;
  if (j==1) return 1;
  if (j==m) return 3;
  return 4;
}

void genera()
{
  int act=0;
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++) {
      if (act+valor(i,j)>k) {
	int resta=k-act;
	if (resta==1) {
	  if (m>j) v[i][m]=1;
	  else v[i+1][1]=1;
	} else if (resta==2) {
	  if (m-j+1>=3) v[i][m-1]=1;
	  else if (m-j+1==2) v[i][m]=v[i+1][m]=v[i+1][m-1]=1;
	  else v[i+1][2]=1;
	} else {
	  // resta==3.
	  if (m-j+1>=4) v[i][m]=v[i][m-2]=1;
	  else if (j==2) {
	    if (i<n) v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=v[i+1][2]=1;
	    else {
	      v[i][1]=0;
	      v[i][2]=v[i][4]=1;
	    }
	  } else v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=1;
	}
	escribe();
	return;
      }
      v[i][j]=1;
      act+=valor(i,j);
      if (act==k) {
	escribe();
	return;
      }
    }
  }
}

int main()
{

  int casos;
  cin>>casos;
  for (int cas=0;cas<casos;cas++) {
    if (cas>0) cout<<endl;
    cin>>n>>m>>k;
    transponer=false;
    if (n>m) {
      swap(n,m);
      transponer=true;
    }
    v=vector<vector<int> > (n+2,vector<int> (m+2,0));
    int total=(n-1)+(n-1)*(m-2)*4+(n-1)*3;
    if (k>total or k==total-1 or k==total-2 or k==total-4 or k==total-5) {
      cout<<-1<<endl;
      continue;
    }
    if (k==total-8) {
      if (n>3) {
	cout<<-1<<endl;
	continue;
      }
      for (int i=1;i<=n;i++)
	for (int j=1;j<=m-1;j++)
	  v[i][j]=1;
      escribe();
      continue;
    }
    if (m==3 and k==7) {
      for (int i=1;i<=3;i++)
	for (int j=1;j<=3;j++)
	  v[i][j]=1;
      v[1][1]=v[3][1]=v[1][3]=0;
      escribe();
      continue;
    }
    genera();
  }
}

#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define pob pop_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0,c=getchar(),f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
int n,m,k,a[100005][500];
int main()
{
	for(int test=read();test--;)
	{
		n=read(),m=read(),k=read();
		bool flag=0;
		if(n<m)swap(n,m),flag=1;
		For(i,1,m)
		{
			For(x,0,n+1)For(y,0,m+1)a[x][y]=0;
			int cnt=0;
			For(y,1,i)a[1][y]=1;
			For(x,2,n)For(y,1,m)
			{
				int ad=a[x-1][y]*a[x][y-1]+a[x-1][y-1]*a[x][y-1]+a[x-1][y]*(a[x-1][y-1]+a[x-1][y+1]);
				if(cnt+ad<=k&&(a[x-1][y]||a[x][y-1]))cnt+=ad,a[x][y]=1;
			}
			if(cnt==k)goto YES;
		}
		puts("-1\n");continue;
		YES:;
		if(flag)
			For(y,1,m)
			{
				For(x,1,n)putchar(a[x][y]?'*':'.');
				puts("");
			}
		else
			For(x,1,n)
			{
				For(y,1,m)putchar(a[x][y]?'*':'.');
				puts("");
			}
		puts("");
	}
}

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py != m - 1)
			{
				a[px][1] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			return 0;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < m - 1 && m - py > 2)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else if (py == 1) {
					if (m != 3)
						a[px + 1][py] = a[px + 1][py + 1] = 1 , a[px][m - 1] = 1;
					else
						a[px + 1][py] = a[px + 1][py + 1] = a[px][m] = a[px + 1][m] = 1;
				}
				else
					a[px][m] = 1 , a[px + 1][py] = a[px + 1][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py == 1)
			{
				if (n == 3)
				{
					if (m == 3)
						return 0;
					a[1][m] = 0 , a[2][m] = 0;
					a[3][m - 1] = 1;
					if (m == 4) a[3][2] = 1;
					else a[3][2] = 1 , a[2][m] = 1;
					return 1;
				}
			}

			if (m - py <= 2)
				return 0;

			if (n == 3 && m - py <= 3) {
				if (m - py < 3)
					return 0;
				a[1][m] = a[2][m] = 0;
				a[px][m - 1] = 1 , a[px][m - 2] = 1;
				return 1;
			}

			if (m - py <= 3) return 0;

			a[1][1] = a[n][1] = a[1][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py != m - 1)
			{
				a[px][1] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			return 0;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < m - 1 && m - py > 2)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else if (py == 1) {
					if (m != 3)
						a[px + 1][py] = a[px + 1][py + 1] = 1 , a[px][m - 1] = 1;
					else
						a[px + 1][py] = a[px + 1][py + 1] = a[px][m] = a[px + 1][m] = 1;
				}
				else
					a[px][m] = 1 , a[px + 1][py] = a[px + 1][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py == 1)
			{
				if (n == 3)
				{
					if (m == 3)
						return 0;
					a[1][m] = 0 , a[2][m] = 0;
					a[3][m - 1] = 1;
					if (m == 4) a[3][2] = 1;
					else a[3][2] = 1 , a[2][m] = 1;
					return 1;
				}
			}

			if (m - py <= 2)
				return 0;

			if (n == 3 && m - py <= 3) {
				if (m - py < 3)
					return 0;
				a[1][m] = a[2][m] = 0;
				a[px][m - 1] = 1 , a[px][m - 2] = 1;
				return 1;
			}

			if (m - py <= 3) return 0;

			a[1][1] = a[n][1] = a[1][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
//		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,m,k;
bool vis[N],w[N];
int q[N];
bool connect(){
	int h=0,t=1,cnt=0;
	memset(vis,0,sizeof(vis));
	for (int i=1;i<=n*m;i++)
		if (w[i]) q[1]=i,cnt++;
	while (h!=t){
		int x=q[++h];
		if (x+m<=n*m&&w[x+m]&&!vis[x+m])
			vis[x+m]=1,cnt--,q[++t]=x+m;
		if (x>m&&w[x-m]&&!vis[x-m])
			vis[x-m]=1,cnt--,q[++t]=x-m;
		if (x%m&&w[x+1]&&!vis[x+1])
			vis[x+1]=1,cnt--,q[++t]=x+1;
		if ((x-1)%m&&w[x-1]&&!vis[x-1])
			vis[x-1]=1,cnt--,q[++t]=x-1;
	}
	return cnt==0;
}

int count(){
	int ans=0;
	for (int i=1;i<=(n-1)*m;i++)
		if (i%m){
			ans+=w[i]&w[i+1]&w[i+m];
			ans+=w[i]&w[i+1]&w[i+m+1];
			ans+=w[i]&w[i+m]&w[i+m+1];
			ans+=w[i+1]&w[i+m]&w[i+m+1];
		}
	return ans;
}
int calc(int mid){
	for (int i=1;i<=n*m;i++)
		w[i]=(i<=mid);
	return count();
}

vector<int> p1,p2;
int work(){
	int c=4*(n-1)*(m-1);
	if (k>c) return 0;
	if (k==c-1||k==c-2||k==c-4||k==c-5) return 0;
	if (k==c-8&&n!=3&&m!=3) return 0;
	int l=0,r=n*m,ans;
	while (l<=r){
		int mid=(l+r)/2;
		if (calc(mid)<=k)
			ans=mid,l=mid+1;
		else r=mid-1;
	}
	int cur=calc(ans);
	if (cur==k) return 1;
	p1.clear(); p2.clear();
	for (int i=1;i<=n*m;i++)
		if (min((i-1)/m,abs((i-1)/m-(ans-1)/m))<=1)
			w[i]?p1.push_back(i):p2.push_back(i);
	for (;cur!=k;){
		int at,x;
		if (cur<k){
			at=rand()%(p2.size());
			x=p2[at]; w[x]=1;
			if (!connect()){
				w[x]=0; continue;
			}
			p2.erase(p2.begin()+at);
			p1.push_back(x);
			cur=count();
		}
		else{
			at=rand()%(p1.size());
			x=p1[at]; w[x]=0;
			if (!connect()){
				w[x]=1; continue;
			}
			p1.erase(p1.begin()+at);
			p2.push_back(x);
			cur=count();
		}
	}
	return 1;
}
void solve(){
	scanf("%d%d%d",&n,&m,&k);
	int fl=(n<m);
	if (fl) swap(n,m);
	if (!work()) puts("-1");
	else if (fl==0)
		for (int i=1;i<=n;i++,puts(""))
			for (int j=1;j<=m;j++)
				printf("%c",w[(i-1)*m+j]?'*':'.');
	else
		for (int i=1;i<=m;i++,puts(""))
			for (int j=1;j<=n;j++)
				printf("%c",w[i+(j-1)*m]?'*':'.');
}
int main(){
	srand(19260817);
	int T; scanf("%d",&T);
	while (T--) solve(),puts("");
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#define N 200010
#define X first
#define Y second
#define g(x,y) ((x-1)*m+y)

using namespace std;

typedef pair<int,int> parii;

int t,n,m,k,Ans,T;
int B[N];
char A[N];

inline int calc(int x,int y){
  int ret=0;
  if(x-1>0&&y+1<=m&&A[g(x-1,y)]=='*'&&A[g(x-1,y+1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x-1,y)]=='*'&&A[g(x-1,y-1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x,y-1)]=='*'&&A[g(x-1,y-1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x,y-1)]=='*'&&A[g(x-1,y)]=='*') ret++;
  return ret;
}

inline bool link(int x,int y){
  if(x-1>0&&A[g(x-1,y)]=='*') return true;
  if(x+1<=n&&A[g(x+1,y)]=='*') return true;
  if(y-1>0&&A[g(x,y-1)]=='*') return true;
  if(y+1<=m&&A[g(x,y+1)]=='*') return true;
  return false;
}

bool S(int x,int y,int s){
  if((++T)>10*n*m) return 0;
  if(s==k) return 1;
  if(x>n) return 0;
  if(y>m) return S(x+1,1,s);
  int now=calc(x,y);
  if((x==1&&y==1)||link(x,y))
    if(s+now<=k){
      A[g(x,y)]='*';
      if(S(x,y+1,s+now)) return 1;
    }
  A[g(x,y)]='.';
  return S(x,y+1,s);
}

int main(){
  scanf("%d",&t);
  while(t--){
    scanf("%d%d%d",&n,&m,&k); T=0;
    int c=0;
    if(n<m){ c=1; swap(n,m); }
    for(int i=1;i<=n*m;i++) A[i]='.';
    if(!S(1,1,0)) puts("-1\n");
    else{
      int E=1;
      for(int i=1;i<=n*m;i++) if(A[i]=='*') E=0;
      if(E) A[1]='*';
      if(!c)
	for(int i=1;i<=n;i++,putchar('\n'))
	  for(int j=1;j<=m;j++) putchar(A[g(i,j)]);
      else
	for(int i=1;i<=m;i++,putchar('\n'))
	  for(int j=1;j<=n;j++) putchar(A[g(j,i)]);
      putchar('\n');
    }
  }
  return 0;
}

#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#define pb push_back
using namespace std;

const int N=100005;

int n,m,K;
int w[N];

inline int count(){
  int ret=0;
  for (int i=0;i<n-1;i++)
    for (int j=0;j<m-1;j++){
      int 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;
int ins[N];

const int dx[]={0,0,1,-1};
const int dy[]={1,-1,0,0};

inline int Jud(){
  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);
  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;
  }
  int L=-1,R=n*m,MID;
  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.pb(i):em.pb(i);
  int x,p;
  while (cur!=K) {
    if (cur<K) {
      x=em[p=rand()%((int)em.size())];
      w[x]=1;
      if (!Jud()) { w[x]=0; continue; }
      em.erase(em.begin()+p); bl.pb(x);
      cur=count();
    }else{
      x=bl[p=rand()%((int)bl.size())];
      w[x]=0;
      if (!Jud()) { w[x]=1; continue; }
      bl.erase(bl.begin()+p); em.pb(x);
      cur=count();
    }
  }
  return 1;
}

#define read(x) scanf("%d",&(x))
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;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<string>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#include<bitset>
#include<vector>
#define rep(x,a,b) for (int x=a;x<=(int)b;x++)
#define drp(x,a,b) for (int x=a;x>=(int)b;x--)
#define cross(x,a) for (int x=hd[a];~x;x=nx[x])
#define ll long long
#define inf (1<<29)
#define PII pair<int,int>
#define PDD pair<double,double>
#define mk(a,b) make_pair(a,b)
#define fs first
#define sc second
#define pb push_back
using namespace std;
inline ll rd(){
	ll x=0;int ch=getchar(),f=1;
	while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();
	if (ch=='-'){f=-1;ch=getchar();}
	while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
inline void rt(ll x){
	if (x<0) putchar('-'),x=-x;
	if (x>=10) rt(x/10),putchar(x%10+'0');
		else putchar(x+'0');
}
const int maxn=100005;
bool dsc;
char s[maxn],vis[20];
int n,m,k;
inline int id(int x,int y){return (x-1)*m+y;}
void dfs(int x,int y,int n,int m){
	vis[id(x,y)]=1;
	if (x>1&&s[id(x-1,y)]=='*'&&!vis[id(x-1,y)]) dfs(x-1,y,n,m);
	if (y>1&&s[id(x,y-1)]=='*'&&!vis[id(x,y-1)]) dfs(x,y-1,n,m);
	if (x<n&&s[id(x+1,y)]=='*'&&!vis[id(x+1,y)]) dfs(x+1,y,n,m);
	if (y<m&&s[id(x,y+1)]=='*'&&!vis[id(x,y+1)]) dfs(x,y+1,n,m);
}
void dfs(int x,int y,int n,int m,int k){
	if (x==n+1){
		if (k) return;
		rep(i,1,n*m) vis[i]=0;
		rep(i,1,n) rep(j,1,m){
			if (s[id(i,j)]=='*'){
				dfs(i,j,n,m);i=n+1;break;
			}
		}
		bool f=1;
		rep(i,1,n*m) if (s[i]=='*'&&!vis[i]){f=0;break;}
		if (f) dsc=1;return;
	}
	if (x==1){
		s[id(x,y)]='*';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
		if (dsc) return;
		s[id(x,y)]='.';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
		return;
	}
	int pls=0;
	if (y>1&&s[id(x-1,y-1)]=='*'&&s[id(x,y-1)]=='*') pls++;
	if (y>1&&s[id(x-1,y-1)]=='*'&&s[id(x-1,y)]=='*') pls++;
	if (y>1&&s[id(x-1,y)]=='*'&&s[id(x,y-1)]=='*') pls++;
	if (y<m&&s[id(x-1,y)]=='*'&&s[id(x-1,y+1)]=='*') pls++;
	if (pls<=k){
		s[id(x,y)]='*';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k-pls);
		if (dsc) return;
	}
	s[id(x,y)]='.';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
	return;
}
int main(){
	for (int T=rd();T--;){
		n=rd(),m=rd(),k=rd();
		rep(i,1,n) rep(j,1,m) s[id(i,j)]='.';
		if (k>(n-1)*(m-1)*4){printf("-1\n\n");continue;}
		if (n<5&&m<5){
			dsc=0;
			dfs(1,1,n,m,k);
			if (dsc){
				rep(i,1,n){
					rep(j,1,m) putchar(s[id(i,j)]);
					putchar('\n');
				}
			}
			else puts("-1");
			puts("");continue;
		}
		int rev=0;
		if (m<5) swap(n,m),rev=1;
		int rem=(n-1)*m;
		if (n==3&&k==8*(m-2)){
			rep(i,1,n) rep(j,2,m) s[id(i,j)]='*';
		}
		else{
			rep(j,1,m) s[id(1,j)]='*';
			for (int i=2;i<=n&&rem>4&&k>3;i++)
				for (int j=1;j<=m&&rem>4&&k>3;j++){
					s[id(i,j)]='*';
					if (j==1) k--;else if (j==m) k-=3;else k-=4;
					rem--;
				}
			int x=n-rem/m,y=m-rem%m;
			if (x<n){
				if (k==1){
					if (y>=2) s[id(x+1,1)]='*';
					else s[id(x,m)]='*';
				}
				else if (k==2){
					if (y>=3) s[id(x+1,1)]=s[id(x+1,y)]='*';
					else if (y==2) s[id(x+1,1)]=s[id(x,m)]='*';
					else s[id(x,m)]=s[id(x+1,1)]=s[id(x+1,2)]='*';
				}
				else if (k==3){
					if (y>=4) s[id(x+1,1)]=s[id(x+1,3)]='*';
					else if (y>=2) s[id(x+1,1)]=s[id(x,m)]=s[id(x+1,m)]=s[id(x+1,m-1)]='*';
					else s[id(x+1,1)]=s[id(x+1,2)]=s[id(x,m)]=s[id(x+1,m)]=s[id(x+1,m-1)]='*';
				}
			}
			else{
				if (k==1) s[id(x,m)]='*';
				else if (k==2) s[id(x,m-2)]='*';
				else if (k==3) s[id(x,m)]=s[id(x,m-2)]='*';
				else if (k==4) s[id(x,y+1)]='*';
				else if (k==5) s[id(x,y+1)]=s[id(x,m)]='*';
				else if (k==6) s[id(x,y+1)]=s[id(x,m-1)]='*';
				else if (k==8) s[id(x,y+1)]=s[id(x,y+2)]='*';
				else if (k==9) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,m)]='*';
				else if (k==12) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,y+3)]='*';
				else if (k==15) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,y+3)]=s[id(x,y+4)]='*';
				else if (k){puts("-1\n");continue;}
			}
		}
		if (rev){
			rep(j,1,m){
				rep(i,1,n) putchar(s[id(i,j)]);
				putchar('\n');
			}
		}
		else{
			rep(i,1,n){
				rep(j,1,m) putchar(s[id(i,j)]);
				putchar('\n');
			}
		}
		puts("");
	}
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int X1[4]={0,0,0,0};
int Y1[4]={-1,-1,1,1};
int X2[4]={-1,1,-1,1};
int Y2[4]={0,0,0,0};
int X[4]={0,0,1,-1};
int Y[4]={1,-1,0,0};
int i,j,k,n,m,x,y,T,Cnt,xx,yy;
bool f,F,f2;
map<int,bool>b[200010],a[200010];
inline int Calc(int x,int y){
	int Ans=0;
	for(int p=0;p<4;p++){
		int xx=x+X1[p],yy=y+Y1[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		xx=x+X2[p];yy=y+Y2[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		Ans++;
	}
	return Ans;
}
inline void Dfs(int x,int y,int Sum){
	if(++Cnt>(n*m*10)||f||Sum>k)return;
	if(Sum==k){
		f=1;
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)a[i][j]=b[i][j];
		return;
	}
	if(y==m+1)x++,y=1;
	if(x==n+1)return;
	bool f3=0;
	for(int p=0;p<4;p++){
		xx=x+X[p];yy=y+Y[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		f3=1;break;
	}
	if(!f2||f3){
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum-=Calc(xx,yy);
		}
		int s=Sum;
		b[x][y]=1;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum+=Calc(xx,yy);
		}
		Dfs(x,y+1,Sum+Calc(x,y));
		f2=1;
		b[x][y]=0;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			s+=Calc(xx,yy);
		}
		Dfs(x,y+1,s);
	}else{
		b[x][y]=0;
		Dfs(x,y+1,Sum);
	}
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&k);
		F=0;
		if(n<m)swap(n,m),F=1;
		f=Cnt=f2=0;Dfs(1,1,0);
		if(f){
			if(F){
				for(i=1;i<=m;i++){
					for(j=1;j<=n;j++)
					if(a[j][i])break;
					if(j<=n)break;
				}
				if(i>m)a[1][1]=1;
				for(i=1;i<=m;i++){
					for(j=1;j<=n;j++)
					if(a[j][i])putchar('*');else putchar('.');
					putchar('\n');
				}
			}else{
				for(i=1;i<=n;i++){
					for(j=1;j<=m;j++)
					if(a[i][j])break;
					if(j<=m)break;
				}
				if(i>n)a[1][1]=1;
				for(i=1;i<=n;i++){
					for(j=1;j<=m;j++)
					if(a[i][j])putchar('*');else putchar('.');
					putchar('\n');
				}
			}
		}else puts("-1");
		putchar('\n');
	}
	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <vector>
#include <map>
using namespace std;

int n, m, t, test, ans, p, T;
bool bo;
//int mp[201010], Ans[201010];
int d[5][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, 0}};
map<pair<int, int>, int> mp, Ans;

//inline int id(int x, int y) {
//	return (x - 1) * (m + 10) + y + 12;
//}
#define id(x, y) make_pair(x, y)
inline void PrintMp(void) {
	int sum;
	sum = 0;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			sum += Ans[id(i, j)];
	if (!sum) Ans[id(1, 1)] = 1;
	if (bo) for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= n; j++)
			putchar(Ans[id(j, i)] ? '*' : '.');
		putchar('\n');
	} else for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++)
			putchar(Ans[id(i, j)] ? '*' : '.');
		putchar('\n');
	}
}
void dfs(int x, int y, int s) {
	if (ans || ++T > n * m * 20) return;
	if (s == t) {
		for (int i = 1; i <= n; i++)
			for (int j = 1; j <= m; j++)
				Ans[id(i, j)] = mp[id(i, j)];
		ans = 1; return;
	}
	if (x > n) return;
	if (y > m) return dfs(x + 1, 1, s);
	int sum = 0, res;
	if (x == 1 && y == 1) res = 1;
	else res = mp[id(x - 1, y)] + mp[id(x, y - 1)];
	sum += mp[id(x, y - 1)] & mp[id(x + 1, y - 1)];
	sum += mp[id(x + 1, y)] & mp[id(x + 1, y - 1)];
	sum += mp[id(x, y + 1)] & mp[id(x + 1, y + 1)];
	sum += mp[id(x + 1, y)] & mp[id(x + 1, y + 1)];
	sum += mp[id(x, y - 1)] & mp[id(x - 1, y - 1)];
	sum += mp[id(x - 1, y)] & mp[id(x - 1, y - 1)];
	sum += mp[id(x, y + 1)] & mp[id(x - 1, y + 1)];
	sum += mp[id(x - 1, y)] & mp[id(x - 1, y + 1)];
	sum += mp[id(x, y + 1)] & mp[id(x + 1, y)];
	sum += mp[id(x, y - 1)] & mp[id(x - 1, y)];
	sum += mp[id(x - 1, y)] & mp[id(x, y + 1)];
	sum += mp[id(x + 1, y)] & mp[id(x, y - 1)];
	if (s + sum <= t && res) {
		mp[id(x, y)] = 1;
		dfs(x, y + 1, s + sum);
		mp[id(x, y)] = 0;
	}
	dfs(x, y + 1, s);
}

int main(void) {
	scanf("%d", &test);
	while (test--) {
		scanf("%d%d%d", &n, &m, &t); bo = 0; T = 0;
		mp.clear(); Ans.clear();
		if (n < m) {
			swap(n, m); p = n; bo = 1;
		}
		ans = 0; dfs(1, 1, 0);
		if (!ans) printf("-1\n");
		else PrintMp();
		putchar('\n');
	}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int h,w,n,want;
bool haveret; char ret[MAXN+1],nret[MAXN+1];

void bf() {
	FOR(msk,1,1<<n) {
		int cur=0;
		REP(x,h-1) REP(y,w-1) {
			int cnt=0;
			REP(dx,2) REP(dy,2) if((msk>>((x+dx)*w+(y+dy)))&1) ++cnt;
			if(cnt==3) ++cur; if(cnt==4) cur+=4;
		}
		if(cur==want) { haveret=true; REP(j,n) ret[j]=(msk>>j)&1?'*':'.'; return; }
	}
}

void greedy() { // w>=5
	if(h==2&&want==(w-2)*4) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=0<=y&&y<w-1?'*':'.'; return; }
	if(h==2&&want==(w-3)*4) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=1<=y&&y<w-1?'*':'.'; return; }
	if(h==3&&want==(w-2)*8) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=0<=y&&y<w-1?'*':'.'; return; }

	int left=want; REP(x,h) REP(y,w) ret[x*w+y]=x==0?'*':'.';
	int x,y;
	for(x=1;x<h;++x) {
		for(y=0;y<w;++y) {
			if(left<=3||x==h-1&&w-y==4) break;
			ret[x*w+y]='*'; left-=y==0?1:y==w-1?3:4;
		}
		if(left<=3||x==h-1&&w-y==4) break;
	}
	if(x==h-1&&w-y==4) {
		REP(msk,1<<4) {
			int cur=0;
			REP(yy,4) {
				int cnt=0;
				REP(dy,2) if(yy+dy==0||(msk>>(yy+dy-1)&1)) ++cnt;
				if(cnt==1) ++cur; if(cnt==2) cur+=4;
			}
			if(cur-1==left) { haveret=true; REP(j,4) ret[x*w+y+j]=(msk>>j)&1?'*':'.'; return; }
		}
	}
	if(left<=3) {
		int dy=w-y; //printf("left=%d dy=%d\n",left,dy);
		int y1=dy==2||dy>=4?w-1:0;
		int y2=dy==3?w-2:dy>=4?w-3:dy==2?1:2;
		if(left&1) ret[(x+(y1<y?1:0))*w+y1]='*';
		if(left&2) ret[(x+(y2<y?1:0))*w+y2]='*';
		haveret=true;
	}
}

void run() {
	scanf("%d%d%d",&h,&w,&want); n=h*w; haveret=false;
	if(h<=4&&w<=4) {
		bf();
	} else {
		bool swp=w<h;
		if(swp) swap(w,h);
		greedy();
		if(swp) { swap(w,h); REP(x,h) REP(y,w) nret[x*w+y]=ret[y*h+x]; REP(i,n) ret[i]=nret[i]; }
	}
	if(!haveret) printf("-1\n"); else REP(x,h) { REP(y,w) printf("%c",ret[x*w+y]); puts(""); }
}

int main() {
	int n; scanf("%d",&n); FORE(i,1,n) { if(i!=1) puts(""); run(); }
	return 0;
}

#include <iostream>
#include <vector>

using namespace std;

int n,m,k;
vector<vector<int> > v;
bool transponer;

void escribe()
{
  if (transponer) {
    vector<vector<int> > nextv(m+2,vector<int> (n+2,0));
    for (int i=1;i<=n;i++)
      for (int j=1;j<=m;j++)
	nextv[j][i]=v[i][j];
    swap(n,m);
    v=nextv;
  }
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++)
      if (v[i][j]) cout<<"*";
      else cout<<".";
    cout<<endl;
  }
}

int valor(int i,int j)
{
  if (i==1) return 0;
  if (j==1) return 1;
  if (j==m) return 3;
  return 4;
}

void genera()
{
  int act=0;
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++) {
      if (act+valor(i,j)>k) {
	int resta=k-act;
	if (resta==1) {
	  if (m>j) v[i][m]=1;
	  else v[i+1][1]=1;
	} else if (resta==2) {
	  if (m-j+1>=3) v[i][m-1]=1;
	  else if (m-j+1==2) v[i][m]=v[i+1][m]=v[i+1][m-1]=1;
	  else v[i+1][2]=1;
	} else {
	  // resta==3.
	  if (m-j+1>=4) v[i][m]=v[i][m-2]=1;
	  else if (j==2) {
	    if (i<n) v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=v[i+1][2]=1;
	    else {
	      v[i][1]=0;
	      v[i][2]=v[i][4]=1;
	    }
	  } else v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=1;
	}
	escribe();
	return;
      }
      v[i][j]=1;
      act+=valor(i,j);
      if (act==k) {
	escribe();
	return;
      }
    }
  }
}

int main()
{
  ios::sync_with_stdio(false);
  int casos;
  cin>>casos;
  for (int cas=0;cas<casos;cas++) {
    if (cas>0) cout<<endl;
    cin>>n>>m>>k;
    transponer=false;
    if (n>m) {
      swap(n,m);
      transponer=true;
    }
    v=vector<vector<int> > (n+2,vector<int> (m+2,0));
    int total=(n-1)+(n-1)*(m-2)*4+(n-1)*3;
    if (k>total or k==total-1 or k==total-2 or k==total-4 or k==total-5) {
      cout<<-1<<endl;
      continue;
    }
    if (k==total-8) {
      if (n>3) {
	cout<<-1<<endl;
	continue;
      }
      for (int i=1;i<=n;i++)
	for (int j=1;j<=m-1;j++)
	  v[i][j]=1;
      escribe();
      continue;
    }
    if (m==3 and k==7) {
      for (int i=1;i<=3;i++)
	for (int j=1;j<=3;j++)
	  v[i][j]=1;
      v[1][1]=v[3][1]=v[1][3]=0;
      escribe();
      continue;
    }
    genera();
  }
}

#include <iostream>
#include <vector>
#include <cstdio>

#define rank krevedka
#define left trulala
#define rigth trulalo
#define ran rank
using namespace std;
/*
void solveA(){

    int n,m;
    cin >> n >>m;
    int tot = 0;
    for(int i = 0; i < n; i++)
    for(int j = 0; j < m; j++)
        b[tot++] = {i,j};
    sort(b, b + n * m);
    int k;
    cin >> k;
    for(int i = 0; i < k; i++)
        cin >> a[i];
    sort(a, a + k);
    bool ok = true;
    for(int i = 0; i < k; i++)
        if(a[i] < b[i].first + b[i].second){ ok = false;}

    cin >> k;
    for(int i = 0; i < k; i++)
        cin >> a[i];
    sort(a, a + k);
    for(int i = 0; i < k; i++)
        if(a[i] < b[i].first + b[i].second){ ok = false;}

}
*/

int x, y, n, m, k;

vector<char> a[200500];

void go(bool get_next = false){
    a[x][y] = '*';
    if(get_next){
        x++;
        if(x == n){ x = 0; y++;}
    }
}

bool solveC(){
    for(int i = 0; i < n; i++){
        a[i].resize(m+10,'\0');
        for(int j = 0; j < m; j++)
            a[i][j] = '.';
        a[i][0] = '*';
    }
    if(k == 0) return true;
    //if(n == 1 || m == 1) return false;
    x = 0;
    y = 1;
    while(k){
        if(y == m) {  return false; }
        int l = 4;
        if(x == 0) l = 1; else
        if(x == n - 1) l = 3;
        if(k >= l){ k -= l; go(true); continue;}
        if(l == 3){
            if(y == m - 1) return false;
            if(k == 1){x = 0; y++; go(); return true;}
            //if(k == 1 && x > 1){x = 0; y++; go(); return true;}
            //if(k == 1){x = 0; y++; go(); x++; go(); return true;}
            // k == 2
            //if(x > 1){
                y++;
                go();
                x--;
                go();
                return true;
            //}
            //y++; go();
            //x--; go();
            //y++; go();
            //if(y >= m) return false;
            //return true;
        }
        // l == 4
        if(k == 1){
            x = n - 1;
            go();
            return true;
        }
        if(k == 2) {
            if(x + 1 < n - 1){
                x++;
                go();
                return true;
            }
            if(y == m - 1) return false;
            x++;
            go();
            y++;
            go();
            x--;
            go();
            return true;
        }
        // k == 3
        if(x + 3 <= n - 1){
            x++;
            go(); // + 2
            x = n - 1;
            go(); // + 1
            return true;
        }
        if(y == m - 1) return false;

        if(x + 2 <= n - 1){
            x++;
            go(); // +2
            y++;
            go(); // +0;
            x++;
            go(); // +1
            return true;
        }
        //if(x + 1 <= n - 1){
            x++;
            go();
            y++;
            go();
            x--;
            go();
            x = 0;
            go();
            return true;
        //}
    }
    return true;

}

int main()
{
    //freopen("output.txt","w",stdout);
    int t= 1000000;
    scanf("%d",&t);
    //t
    for(int q = 0; q < t; q++){
        if(q) printf("\n");
        n = q % 100;        n += 3;
        m = (q/100) % 100;        m += 3;
        k = q/1000;
        scanf("%d%d%d",&n,&m,&k);
        int kk = k;
        if(solveC()){
            for(int i = 0; i < n; i++){
                for(int j = 0; j < m; j++)
                    printf("%c",a[i][j]);
                printf("\n");
            }
        }else{
            swap(n,m);
            k = kk;
            if(solveC()){
                for(int j = 0; j < m; j++){
                    for(int i = 0; i < n; i++)
                        printf("%c",a[i][j]);
                    printf("\n");
                }
            }else puts("-1");
        }

    }
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int xx[N],yy[N],yes[N],n,m,cnt,now,flag,x,y,X,Y,K,L=13;
vi a[N];

int calc(int x,int y){
	int res=0;
	res+=a[x-1][y-1]&a[x-1][y];
	res+=a[x-1][y-1]&a[x][y-1];
	res+=a[x-1][y]&a[x][y-1];
	res+=a[x-1][y]&a[x-1][y+1];
	return res;
}

int chk(int s){
	static int q[N];
	int l=0,r=0;
	rep(i,1,cnt){
		a[xx[i]][yy[i]]=0;
		yes[i]=0;
		if(!(s>>(i-1)&1)) continue;
		if(xx[i]==x||xx[i]==x+1&&yy[i]<=y) yes[i]=1,q[r++]=i;
	}
	while(l<r){
		int u=q[l++];
		rep(v,1,cnt)if(s>>(v-1)&1){
			if(!yes[v]&&abs(xx[u]-xx[v])+abs(yy[u]-yy[v])==1){
				yes[v]=1,q[r++]=v;
			}
		}
	}
	rep(i,1,cnt) if((s>>(i-1)&1)&&!yes[i]) return 0;
	int sum=now;
	rep(i,1,cnt) if(s>>(i-1)&1) sum+=calc(xx[i],yy[i]),a[xx[i]][yy[i]]=1;
	return sum==K;
}

void rmain(){
	read(n),read(m),read(K);
	if(n<m) swap(n,m),flag=1; else flag=0;
	rep(i,0,n+1) a[i].clear(),a[i].resize(m+2);
	now=0,x=n,y=m;
	int rem=n*m;
	rep(i,1,n){
		int owo=0;
		rep(j,1,m){
			int nxt=calc(i,j); rem--;
			if(now+nxt<=K&&rem>=L) now+=nxt,a[i][j]=1;
			else {x=i,y=j-1; if(y==0)y=m,x--; owo=1;break;}
		}
		if(owo) break;
	}
	cnt=0,X=x,Y=y;
	int Flag=(x<n);
	while(cnt+flag<L){
		Y++; if(Y>m) X++,Y=1;
		if(X>n) break;
		xx[++cnt]=X,yy[cnt]=Y;
		if(X==x+1&&Y==y) Flag=0;
	}
	if(Flag) xx[++cnt]=x+1,yy[cnt]=y;
	int found=0;
	for(int s=(x==0?1:0);s<(1<<cnt);s++)
		if(chk(s)){
			found=1;
			break;
		}
	if(!found){
		puts("-1");
		return;
	}
	if(flag) swap(n,m);
	rep(i,1,n){
		rep(j,1,m) printf("%c",(flag?a[j][i]:a[i][j])?'*':'.');
		puts("");
	}
}

int main(){
	int T; read(T);
	while(T--) rmain(),puts("");
	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define pb push_back
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.pb(i):em.pb(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.pb(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.pb(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;
}

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ());

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

int n, m, k;

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return false;
  }
  return true;
}

void printAns(vector<string> ans, bool rev) {
  if (rev) {
    vector<string> ans0(m, string(n, '.'));
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        ans0[j][i] = ans[i][j];
      }
    }
    ans = ans0;
    swap(n, m);
  }
  for (int i = 0; i < n; i++) {
    printf("%s\n", ans[i].c_str());
  }
}

const int maxn = 10;
const int gox[] = {1, 0, -1, 0}, goy[] = {0, 1, 0, -1};
int used[maxn][maxn];
vector<string> c;

void dfs(int x, int y) {
  used[x][y] = true;
  for (int dir = 0; dir < 4; dir++) {
    int nx = x + gox[dir], ny = y + goy[dir];
    if (0 <= nx && nx < n && 0 <= ny && ny < m && c[nx][ny] == '*' && !used[nx][ny]) {
      dfs(nx, ny);
    }
  }
}

void solve() {
  int s = 4 * (n - 1) * (m - 1);
  if (k > s) {
    printf("-1\n");
    return;
  }
  if (k == s - 1 || k == s - 2 || k == s - 5) {
    printf("-1\n");
    return;
  }
  if (n < 5 && m < 5) {
    for (int msk = 0; msk < (1 << (n * m)); msk++) {
      c = vector<string>(n, string(m, '.'));
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (msk & (1 << (i * m + j))) {
            c[i][j] = '*';
          }
        }
      }
      int cur = 0;
      for (int i = 0; i + 1 < n; i++) {
        for (int j = 0; j + 1 < m; j++) {
          int x = (c[i][j] == '*') + (c[i][j + 1] == '*') + (c[i + 1][j] == '*') + (c[i + 1][j + 1] == '*');
          if (x == 4) {
            cur += 4;
          } else if (x == 3) {
            cur++;
          }
        }
      }
      if (cur != k) {
        continue;
      }
      memset(used, 0, sizeof(used));
      int cnt = 0;
      for (int i = 0; i < n && cnt <= 1; i++) {
        for (int j = 0; j < m && cnt <= 1; j++) {
          if (c[i][j] == '*' && !used[i][j]) {
            dfs(i, j);
            cnt++;
          }
        }
      }
      if (cnt != 1) {
        continue;
      }
      printAns(c, false);
      return;
    }
    printf("-1\n");
    return;
  }
  bool rev = false;
  if (m < 5) {
    swap(n, m);
    rev = true;
  }
  if (k == s - 4) {
    if (n > 2) {
      printf("-1\n");
      return;
    }
    string row = string(m - 1, '*') + ".";
    vector<string> ans = {row, row};
    printAns(ans, rev);
    return;
  }
  if (k == s - 8) {
    if (n > 3) {
      printf("-1\n");
      return;
    }
    if (n == 3) {
      string row = string(m - 1, '*') + ".";
      vector<string> ans = {row, row, row};
      printAns(ans, rev);
      return;
    }
    string row = string(m - 2, '*') + "..";
    vector<string> ans = {row, row};
    printAns(ans, rev);
    return;
  }
  vector<string> ans(n, string(m, '.'));
  int i = 0;
  while (4 * i * (m - 1) <= k) {
    for (int j = 0; j < m; j++) {
      ans[i][j] = '*';
    }
    i++;
  }
  if (4 * (i - 1) * (m - 1) == k) {
    printAns(ans, rev);
    return;
  }
  int j = 0;
  while (4 * (i - 1) * (m - 1) + (j ? 1 + 4 * (j - 1) : 0) + (m - j - 1) < k) {
    ans[i][j] = '*';
    j++;
  }
  int r = k - (4 * (i - 1) * (m - 1) + (j ? 1 + 4 * (j - 1) : 0));
  if (r >= 0) {
    for (int j = 0; j < r; j += 2) {
      ans[i][m - r + j] = '*';
    }
    printAns(ans, rev);
    return;
  }
  j--;
  ans[i][j] = '.';
  r = k - (4 * (i - 1) * (m - 1) + (j ? 1 + 4 * (j - 1) : 0));
  int rup = r - (m - j - 1);
  assert(rup <= 2);
  if (rup == 1) {
    assert(j >= 2);
    ans[i + 1][0] = '*';
  } else {
    assert(j >= 3);
    ans[i + 1][1] = '*';
  }
  r -= rup;
  for (int j = 0; j < r; j += 2) {
    ans[i][m - r + j] = '*';
  }
  printAns(ans, rev);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  int t;
  scanf("%d", &t);
  bool fst = true;
  while (read()) {
    if (fst) {
      fst = false;
    } else {
      printf("\n");
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int xx[N],yy[N],yes[N],n,m,cnt,now,flag,x,y,X,Y,K,L=11;
vi a[N];

int calc(int x,int y){
	int res=0;
	res+=a[x-1][y-1]&a[x-1][y];
	res+=a[x-1][y-1]&a[x][y-1];
	res+=a[x-1][y]&a[x][y-1];
	res+=a[x-1][y]&a[x-1][y+1];
	return res;
}

int chk(int s){
	static int q[N];
	int l=0,r=0;
	rep(i,1,cnt){
		a[xx[i]][yy[i]]=0;
		yes[i]=0;
		if(!(s>>(i-1)&1)) continue;
		if(xx[i]==x||xx[i]==x+1&&yy[i]<=y) yes[i]=1,q[r++]=i;
	}
	while(l<r){
		int u=q[l++];
		rep(v,1,cnt)if(s>>(v-1)&1){
			if(!yes[v]&&abs(xx[u]-xx[v])+abs(yy[u]-yy[v])==1){
				yes[v]=1,q[r++]=v;
			}
		}
	}
	rep(i,1,cnt) if((s>>(i-1)&1)&&!yes[i]) return 0;
	int sum=now;
	rep(i,1,cnt) if(s>>(i-1)&1) sum+=calc(xx[i],yy[i]),a[xx[i]][yy[i]]=1;
	return sum==K;
}

void rmain(){
	read(n),read(m),read(K);
	if(n<m) swap(n,m),flag=1; else flag=0;
	rep(i,0,n+1) a[i].clear(),a[i].resize(m+2);
	now=0,x=n,y=m;
	int rem=n*m;
	rep(i,1,n){
		int owo=0;
		rep(j,1,m){
			int nxt=calc(i,j); rem--;
			if(now+nxt<=K&&rem>=L) now+=nxt,a[i][j]=1;
			else {x=i,y=j-1; if(y==0)y=m,x--; owo=1;break;}
		}
		if(owo) break;
	}
	cnt=0,X=x,Y=y;
	int Flag=(x<n);
	while(cnt+flag<L){
		Y++; if(Y>m) X++,Y=1;
		if(X>n) break;
		xx[++cnt]=X,yy[cnt]=Y;
		if(X==x+1&&Y==y) Flag=0;
	}
	if(Flag) xx[++cnt]=x+1,yy[cnt]=y;
	int found=0;
	for(int s=(x==0?1:0);s<(1<<cnt);s++)
		if(chk(s)){
			found=1;
			break;
		}
	if(!found){
		puts("-1");
		return;
	}
	if(flag) swap(n,m);
	rep(i,1,n){
		rep(j,1,m) printf("%c",(flag?a[j][i]:a[i][j])?'*':'.');
		puts("");
	}
}

int main(){
	int T; read(T);
	while(T--) rmain(),puts("");
	return 0;
}

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;

const int N = 100100;

typedef pair<int, int> pii;
#define mp make_pair

int n, m, k;
bool rev;
vector<int> a[N];
const int BOUND = 11;

void clear()
{
	for (int i = 0; i < n; i++)
	{
		a[i].clear();
		a[i].resize(m);
		for (int j = 0; j < m; j++)
			a[i][j] = 0;
	}
}

int calcSquare(int x, int y)
{
	if (x < 0 || y < 0 || x + 1 >= n || y + 1 >= m) return 0;
	return a[x][y] + a[x + 1][y] + a[x][y + 1] + a[x + 1][y + 1];
}

int evalScore(int x)
{
	if (x == 4) return 3;
	if (x == 3) return 1;
	return 0;
}

void printAns()
{
	if (!rev)
	{
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < m; j++)
				if (a[i][j] == 1)
					printf("*");
				else
					printf(".");
			printf("\n");
		}
	}
	else
	{
		for (int i = 0; i < m; i++)
		{
			for (int j = 0; j < n; j++)
				if (a[j][i] == 1)
					printf("*");
				else
					printf(".");
			printf("\n");
		}
	}
	return;
}

void solveStupid()
{
	clear();
	int x = 0;
	for (int i = 0; x < k &&i < n; i++)
		for (int j = 0; x < k && j < m; j++)
		{
			int oldX = x;
			a[i][j] = 1;
			x += evalScore(calcSquare(i - 1, j - 1));
			x += evalScore(calcSquare(i - 1, j));
			if (x > k)
			{
				a[i][j] = 0;
				x = oldX;
			}
		}
	if (x != k) throw;
	printAns();
	return;
}

int off(int x, int y)
{
	if (a[x][y] == 0) throw;
	int res = 0;
	res += evalScore(calcSquare(x - 1, y - 1));
	res += evalScore(calcSquare(x - 1, y));
	res += evalScore(calcSquare(x, y - 1));
	res += evalScore(calcSquare(x, y));
	a[x][y] = 0;
	return res;
}

void solveBrute()
{
	clear();
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)
			a[i][j] = 1;
	k = 4 * (n - 1) * (m - 1) - k;
//	printf("%d\n", k);
	vector<pii> pos;
	pos.push_back(mp(0, 0));
	pos.push_back(mp(1, 0));
	pos.push_back(mp(0, 1));
	pos.push_back(mp(0, 2));
	pos.push_back(mp(0, m - 1));
	pos.push_back(mp(n - 1, 0));
	pos.push_back(mp(n - 1, m - 1));
//	pos.push_back(mp(1, 1));
	if (m > 3)
		pos.push_back(mp(0, 3));

	sort(pos.begin(), pos.end());
	pos.resize(unique(pos.begin(), pos.end()) - pos.begin());
	int w = (int)pos.size();
	for (int mask = 0; mask < (1 << w); mask++)
	{
		if (mask > 0 && ((mask & 1) == 0)) continue;
		for (int i = 0; i < w; i++)
			a[pos[i].first][pos[i].second] = 1;
		int cur = k;
		for (int i = 0; i < w; i++)
		{
			if (((mask >> i) & 1) == 0) continue;
			cur -= off(pos[i].first, pos[i].second);
		}
		if (cur == 0)
		{
			printAns();
			return;
		}
	}
	printf("-1\n");
	return;
}

void solve()
{
	scanf("%d%d%d", &n, &m, &k);
	if(k == 0){
	     for(int i = 0; i < n; i++){
	          for(int j = 0; j < m; j++){
	               if(i == 0 && j ==0) printf("*");
	               else printf(".");
	          }
	          printf("\n");
	     }
	     return;
	}
	rev = 0;
	if (n > m)
	{
		swap(n, m);
		rev = 1;
	}
	int delta = 4 * (n - 1) * (m - 1) - k;
	if (delta < 0)
	{
		printf("-1\n");
		return;
	}
	if (delta >= BOUND)
	{
		solveStupid();
		return;
	}
	solveBrute();
	return;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int t;
	scanf("%d", &t);
	while(t--)
	{
		solve();
		if (t != 0) printf("\n");
//		printf("\n");
	}

	return 0;
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=101000;
int val[N];
int _,n,m,k;
int count() {
	int cnt=0;
	rep(i,0,n-1) rep(j,0,m-1)  {
		int id=i*m+j;
		cnt+=val[id]&val[id+m]&val[id+1];
		cnt+=val[id+m+1]&val[id+m]&val[id+1];
		cnt+=val[id]&val[id+m]&val[id+m+1];
		cnt+=val[id]&val[id+1]&val[id+m+1];
	}
	return cnt;
}
int check(int md) {
	rep(i,0,n*m) val[i]=i<md;
	return count();
}
int q[N],vis[N];
bool connected() {
	int t=0;
	rep(i,0,n*m) if (val[i]) {q[t++]=i; break;}
	rep(i,0,n*m) vis[i]=0;
	vis[q[0]]=1;
	rep(i,0,t) {
		int u=q[i];
		if (u%m>0&&val[u-1]&&!vis[u-1]) {
			q[t++]=u-1; vis[u-1]=1;
		}
		if (u%m<m-1&&val[u+1]&&!vis[u+1]) {
			q[t++]=u+1; vis[u+1]=1;
		}
		if (u/m>0&&val[u-m]&&!vis[u-m]) {
			q[t++]=u-m; vis[u-m]=1;
		}
		if (u/m<n-1&&val[u+m]&&!vis[u+m]) {
			q[t++]=u+m; vis[u+m]=1;
		}
	}
	rep(i,0,n*m) if (vis[i]!=val[i]) return 0;
	return 1;
}
bool gao(int n,int m,int t) {
	if (t>4*(n-1)*(m-1)) return 0;
	if (n==3||m==3) {
		int rem=4*(n-1)*(m-1)-t;
		if (rem==1||rem==2||rem==4||rem==5) return 0;
	} else {
		int rem=4*(n-1)*(m-1)-t;
		if (rem==1||rem==2||rem==4||rem==5||rem==8) return 0;
	}
	int l=0,r=n*m+1;
	while (l+1<r) {
		int md=(l+r)>>1;
		if (check(md)>=t) r=md; else l=md;
	}
	int c=check(r);
	if (c==t) {
		return 1;
	}
	VI bl,em;
	rep(i,0,n*m) if (i/m<=1||abs(i/m-r/m)<=1) {
		if (val[i]) bl.pb(i); else em.pb(i);
	}
	while (c!=t) {
		if (c<t) {
			assert(!em.empty());
			int p=rand()%SZ(em);
			int v=em[p];
			val[v]=1;
			if (!connected()) {
				val[v]=0;
				continue;
			}
			em.erase(em.begin()+p);
			bl.pb(v);
			val[v]=1;
			c=count();
		} else {
			assert(!bl.empty());
			int p=rand()%SZ(bl);
			int v=bl[p];
			val[v]=0;
			if (!connected()) {
				val[v]=1;
				continue;
			}
			bl.erase(bl.begin()+p);
			em.pb(v);
			val[v]=0;
			c=count();
		}
	}
	assert(t==count());
	assert(connected());
	return 1;
}
int main() {
	for (scanf("%d",&_);_;_--) {
		scanf("%d%d%d",&n,&m,&k);
		if (!gao(n,m,k)) {
			puts("-1");
			puts("");
		} else {
			rep(i,0,n) {
				rep(j,0,m) if (val[i*m+j]) putchar('*'); else putchar('.');
				puts("");
			}
			puts("");
		}
	}
}

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=101000;
int val[N];
int _,n,m,k;
int count() {
	int cnt=0;
	rep(i,0,n-1) rep(j,0,m-1)  {
		int id=i*m+j;
		cnt+=val[id]&val[id+m]&val[id+1];
		cnt+=val[id+m+1]&val[id+m]&val[id+1];
		cnt+=val[id]&val[id+m]&val[id+m+1];
		cnt+=val[id]&val[id+1]&val[id+m+1];
	}
	return cnt;
}
int check(int md) {
	rep(i,0,n*m) val[i]=i<md;
	return count();
}
int q[N],vis[N];
bool connected() {
	int t=0;
	rep(i,0,n*m) if (val[i]) {q[t++]=i; break;}
	rep(i,0,n*m) vis[i]=0;
	vis[q[0]]=1;
	rep(i,0,t) {
		int u=q[i];
		if (u%m>0&&val[u-1]&&!vis[u-1]) {
			q[t++]=u-1; vis[u-1]=1;
		}
		if (u%m<m-1&&val[u+1]&&!vis[u+1]) {
			q[t++]=u+1; vis[u+1]=1;
		}
		if (u/m>0&&val[u-m]&&!vis[u-m]) {
			q[t++]=u-m; vis[u-m]=1;
		}
		if (u/m<n-1&&val[u+m]&&!vis[u+m]) {
			q[t++]=u+m; vis[u+m]=1;
		}
	}
	rep(i,0,n*m) if (vis[i]!=val[i]) return 0;
	return 1;
}
bool gao(int n,int m,int t) {
	if (t>4*(n-1)*(m-1)) return 0;
	if (n==3||m==3) {
		int rem=4*(n-1)*(m-1)-t;
		if (rem==1||rem==2||rem==4||rem==5) return 0;
	} else {
		int rem=4*(n-1)*(m-1)-t;
		if (rem==1||rem==2||rem==4||rem==5||rem==8) return 0;
	}
	int l=0,r=n*m+1;
	while (l+1<r) {
		int md=(l+r)>>1;
		if (check(md)>=t) r=md; else l=md;
	}
	int c=check(r);
	if (c==t) {
		return 1;
	}
	VI bl,em;
	rep(i,0,n*m) if (i/m<=1||abs(i/m-r/m)<=1) {
		if (val[i]) bl.pb(i); else em.pb(i);
	}
	while (c!=t) {
		if (c<t) {
			assert(!em.empty());
			int p=rand()%SZ(em);
			int v=em[p];
			val[v]=1;
			if (!connected()) {
				val[v]=0;
				continue;
			}
			em.erase(em.begin()+p);
			bl.pb(v);
			val[v]=1;
			c=count();
		} else {
			assert(!bl.empty());
			int p=rand()%SZ(bl);
			int v=bl[p];
			val[v]=0;
			if (!connected()) {
				val[v]=1;
				continue;
			}
			bl.erase(bl.begin()+p);
			em.pb(v);
			val[v]=0;
			c=count();
		}
	}
	assert(t==count());
	assert(connected());
	return 1;
}
int main() {
	for (scanf("%d",&_);_;_--) {
		scanf("%d%d%d",&n,&m,&k);
		bool fg;
		if (n<m) swap(n,m),fg=1; else fg=0;
		if (!gao(n,m,k)) {
			puts("-1");
			puts("");
		} else {
			if (!fg) {
				rep(i,0,n) {
					rep(j,0,m) if (val[i*m+j]) putchar('*'); else putchar('.');
					puts("");
				}
			} else {
				rep(j,0,m) {
					rep(i,0,n) if (val[i*m+j]) putchar('*'); else putchar('.');
					puts("");
				}
			}
			puts("");
		}
	}
}

#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()

#define equal equalll
#define less lesss
const int N = -1;
const long long INF = 1e9 + 19;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int n, m, k;

void read() {
    scanf("%d%d%d", &n, &m, &k);
    //db3(n, m, k);
}
set < pair < int, int > > forCheck;

int getAll(int n, int m) {
    return 4 * (n - 1) * (m - 1);
}

bool check(int x, int y) {
    return 0 <= x && x < n && 0 <= y && y < m;
}

vector<pair<int,int>> norm(pair<int,int> p1, pair<int,int> p2, pair<int,int> p3) {
    if (p2 > p3) swap(p2, p3);
    return {p1, p2, p3};
}

map < pair < pair < int, int>, int > , vector<vector<char>> > cache;

void print(vector < vector < char > > board, bool flagSwap) {
    if (flagSwap == 0) {
        cache[mp(mp(n, m), k)] = board;
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[i][j]);
    }
    else {
        swap(n, m);
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[j][i]);
    }
}

int calcRes(const vector<vector<char>>& board) {
    int res = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            for (int id = 0; id < 4; id++) {
                int x1 = i + dx[id];
                int y1 = j + dy[id];
                int x2 = i + dx[(id + 1) % 4];
                int y2 = j + dy[(id + 1) % 4];
                if (check(x1, y1) && check(x2, y2) && board[i][j] == '*' && board[x1][y1] == '*' && board[x2][y2] == '*') {
                    res++;
                }
            }
        }
    return res;
}

bool uu[10][10];
int cc;

void dfs(int x, int y, const set<pair<int,int>>& blocked) {
    uu[x][y] = 1;
    cc++;
    for (int i = 0; i < 4; i++) {
        int x1 = x + dx[i];
        int y1 = y + dy[i];
        if (check(x1, y1) && !uu[x1][y1] && blocked.count(mp(x1, y1)) == 0) {
            dfs(x1, y1, blocked);
        }
    }
}

bool brute() {
    vector < pair < int, int > > data(all(forCheck));
    int sz = data.size();
    set < pair < int, int > > g;
    for (auto p: data) {
        for (int i = 0; i < 4; i++) {
            int x = p.fr + dx[i];
            int y = p.sc + dy[i];
            g.insert(mp(x, y));
        }
    }
    set < vector < pair < int, int > > > tri;

    for (auto p: g) {
        for (int i = 0; i < 4; i++) {
            int x1 = p.fr + dx[i];
            int y1 = p.sc + dy[i];
            int x2 = p.fr + dx[(i + 1) % 4];
            int y2 = p.sc + dy[(i + 1) % 4];
            if (check(p.fr, p.sc) && check(x1, y1) && check(x2, y2))
                tri.insert(norm(p, mp(x1, y1), mp(x2, y2)));
        }
    }

    for (int mask = 0; mask < (1 << sz); mask++) {
        //mask = 27;
        set<pair<int,int>> blocked;
        for (int i = 0; i < sz; i++)
            if (((mask >> i) & 1) == 1) {
                blocked.insert(data[i]);
            }
        int cnt = getAll(n, m);
        for (auto tr: tri) {
            bool flag = 0;
            flag |= blocked.count(tr[0]) == 1;
            flag |= blocked.count(tr[1]) == 1;
            flag |= blocked.count(tr[2]) == 1;
            cnt -= flag;
        }
        bool con = 1;
        if (n * m <= 16) {
            memset(uu, 0, sizeof(uu));
            bool ff = 0;
            for (int i = 0; !ff && i < n; i++)
                for (int j = 0; !ff && j < m; j++) {
                    if (blocked.count(mp(i, j)) == 0) {
                        cc = 0;
                        dfs(i, j, blocked);
                        //db2(cc + blocked.size(), n * m);
                        if (cc + (int)blocked.size() == n * m)
                            con = 1;
                        else
                            con = 0;
                        ff = 1;
                        break;
                    }
                }
        }
        //db3(con, cnt, k);
        if (con && n * m <= 16 && cache.count(mp(mp(n, m), cnt)) == 0) {
            vector<vector<char>> board(n, vector<char>(m, '*'));
            for (auto p: blocked)
                board[p.fr][p.sc] = '.';
            cache[mp(mp(n, m), cnt)] = board;
        }
        if (cnt == k && con) {
            vector<vector<char>> board(n, vector<char>(m, '*'));
            for (auto p: blocked)
                board[p.fr][p.sc] = '.';
            assert(calcRes(board) == k);
            print(board, 0);
            return 1;
        }
        //exit(0);
    }
    return 0;
}

void solve() {
    if (getAll(n, m) == k + 1 || getAll(n, m) == k + 2 || getAll(n, m) == k + 4 || getAll(n, m) == k + 5) {
        puts("-1");
        return;
    }
    //db(cache.size());
    if (cache.count(mp(mp(n, m), k)) == 1) {
        print(cache[mp(mp(n, m), k)], 0);
        return;
    }
    if (k == 0) {
        vector<vector<char>> board(n, vector<char>(m, '.'));
        board[0][0] = '*';
        print(board, 0);
        return;
    }
    forCheck.clear();
    if (n * m <= 16) {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                forCheck.insert(mp(i, j));
        if (brute())
            return;
        else {
            puts("-1");
            return;
        }
    }
    else {
        forCheck.clear();
        for (int i = 0; i < 3; i++){
            forCheck.insert(mp(0, i));
            forCheck.insert(mp(0, m - 1 - i));
        }
        if (brute())
            return;
        forCheck.clear();
        for (int i = 0; i < 3; i++){
            forCheck.insert(mp(i, 0));
            forCheck.insert(mp(n - 1 - i, 0));
        }
        if (brute())
            return;
    }

    bool flagSwap = 0;
    if (n > m) {
        swap(n, m);
        flagSwap = 1;
    }

    if (k > getAll(n, m)) {
        puts("-1");
        return;
    }
    int cur = 1;
    for (; getAll(cur + 1, m) <= k; cur++);

    assert(m >= 5);
    int curM = 0;
    int need = k - getAll(cur, m);
    //db(need);
    for (; ((curM + 1) - 1) * 4 + 1 <= need; curM++);

    if (curM >= 1)
        need -= (curM - 1) * 4 + 1;

    //db(need);
    vector<vector<char>> board(n, vector<char>(m, '.'));
    for (int i = 0; i < cur; i++)
        for (int j = 0; j < m; j++)
            board[i][j] = '*';
    for (int j = 0; j < curM; j++)
        board[cur][j] = '*';
    int xup = min(need, m - curM - 1);

    need -= xup;
    for (int j = m - xup; j < m; j += 2)
        board[cur][j] = '*';

    //print(board, 0);
    //db(need);

    if (need > 0 && cur + 1 < n) {
        //assert(cur + 1 < n);
        for (int j = need - 1; j >= 0; j -= 2)
            board[cur + 1][j] = '*';
        assert(need < curM);
        need = 0;
    }
    int res = calcRes(board);
    assert(res + need == k);

    if (need == 0) {
        print(board, flagSwap);
        return;
    }
    else
        puts("-1");

}

void stress() {
    n = 4;
    m = 4;
    int T = (n - 1) * (m - 1) * 4;
    for (int t = 0; t <= T; t++) {
        k = t;
        db3(n, m, k);
        solve();
    }
    cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl;
}

int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("test.txt", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    //printf(".*.\n***\n.*.\n\n");
    //printf("**.\n**.\n*..\n\n");
    //printf(".*.\n***\n*..\n");
    //return 0;
    if (1) {
        int k = 1;
        scanf("%d", &k);
        for (int tt = 0; tt < k; tt++) {
            //db(tt);
            read();
            solve();
            if (tt + 1 != k)
                puts("");
        }
    }
    else {
        stress();
    }

    return 0;
}

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <ctime>
#include <string>
#include <queue>

using namespace std;

#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long double ld;
typedef long long ll;

long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}

inline int myrand() {
#ifdef _WIN32
  return abs((rand() << 15) ^ rand());
#else
  return rand();
#endif
}

inline int rnd(int x) {
  return myrand() % x;
}

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define TASKNAME "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

const int K = 5;
int prec[K][K][K * K * 4];

void precalc() {
  memset(prec, -1, sizeof(prec));
}

int n, m, k;

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return 0;
  }
  return 1;
}

const int maxn = (int) 1e5 + 10;
vector<string> a;

const int gox[] = {1, 0, -1, 0}, goy[] = {0, 1, 0, -1};

vector<vector<bool> > used;

bool ok(int x, int y) {
  return 0 <= x && x < n && 0 <= y && y < m;
}

int dfs(int x, int y) {
  used[x][y] = 1;
  int res = 1;
  for (int dir = 0; dir < 4; ++dir) {
    int nx = x + gox[dir], ny = y + goy[dir];
    if (ok(nx, ny) && a[nx][ny] == '*' && !used[nx][ny]) {
      res += dfs(nx, ny);
    }
  }
  return res;
}

int getFunc() {
  assert(sz(a) == n);
  for (int i = 0; i < n; ++i) {
    assert(sz(a[i]) == m);
    for (int j = 0; j < m; ++j) {
      if (a[i][j] == '*') {
        used = vector<vector<bool> >(n, vector<bool>(m, 0));
        int cnt = dfs(i, j);
        int want = 0;
        for (int r = 0; r < n; ++r) {
          want += count(a[r].begin(), a[r].end(), '*');
        }
        if (want != cnt) {
          return -1;
        }
        int res = 0;
        for (int i = 0; i < n - 1; ++i) {
          for (int j = 0; j < m - 1; ++j) {
            int cnt = (a[i][j] == '*') + (a[i + 1][j] == '*') + (a[i][j + 1] == '*') + (a[i + 1][j + 1] == '*');
            if (cnt == 3) {
              ++res;
            }
            if (cnt == 4) {
              res += 4;
            }
          }
        }
        return res;
      }
    }
  }
  return -1;
}

bool getAns() {
  int mx = (n - 1) * (m - 1) * 4;
  if (k > mx) {
    return 0;
  }

  if (n < K && m < K) {
    int cnt = n * m;
    a.resize(n);

    if (prec[n][m][k] == 0) {
      return 0;
    }
    int left = 0, right = (1 << cnt);
    if (prec[n][m][k] != -1) {
      left = prec[n][m][k], right = left + 1;
    }

    for (int mask = left; mask < right; ++mask) {
      for (int i = 0; i < n; ++i) {
        a[i].resize(m);
        for (int j = 0; j < m; ++j) {
          a[i][j] = ((mask >> (i * m + j)) & 1) ? '*' : '.';
        }
      }
      int got = getFunc();
      if (got != -1) {
        prec[n][m][got] = mask;
      }
      if (got == k) {
        return 1;
      }
    }
    for (int t = 0; t <= mx; ++t) {
      if (prec[n][m][t] == -1) {
        prec[n][m][t] = 0;
      }
    }
    return 0;
  }

  if (k == mx - 1 || k == mx - 2 || k == mx - 4 || k == mx - 5) {
    return 0;
  }

  bool torev = 0;
  if (n > m) {
    torev = 1;
    swap(n, m);
  }

  if (k == mx - 8) {
    if (n != 3) {
      if (torev) {
        swap(n, m);
      }
      return 0;
    }
  }

  a.resize(n);
  if (k == mx - 8) {
    for (int i = 0; i < n; ++i) {
      a[i] = string(m - 1, '*') + ".";
    }
  } else {
    for (int i = 0; i < n; ++i) {
      a[i] = string(m, !i ? '*' : '.');
    }
    int left = k;
    for (int i = 1; i < n && left > 0; ++i) {
      if (left < 5) {
        if (left >= 2) {
          a[i][2] = '*';
          left -= 2;
        }
        if (left >= 1) {
          a[i][0] = '*';
          left -= 1;
        }
        if (left >= 1) {
          a[i][m - 1] = '*';
          left -= 1;
        }
        break;
      }
      a[i][0] = a[i][1] = '*';
      left -= 5;
      for (int j = 2; j < m && left > 0; ++j) {
        int cur = (j == m - 1 ? 3 : 4);
        if (left < cur) {
          if (cur == 4) {
            if (left == 1) {
              a[i].back() = '*';
              --left;
              break;
            }
            if (left == 2) {
              if (j < m - 2) {
                a[i][j + 1] = '*';
              } else {
                assert(i + 1 < n);
                a[i + 1][1] = '*';
              }
              left -= 2;
              break;
            }
            if (left == 3) {
              if (j < m - 3) {
                a[i][j + 1] = a[i][m - 1] = '*';
              } else {
                if (j == m - 3) {
                  assert(i + 1 < n);
                  a[i][m - 2] = a[i + 1][0] = '*';
                } else {
                  assert(j == m - 2);
                  assert(i + 1 < n);
                  a[i][m - 1] = a[i + 1][1] = '*';
                }
              }
              left -= 3;
              break;
            }
          } else {
            assert(i + 1 < n);
            a[i + 1][left - 1] = '*';
            left = 0;
            break;
          }
          assert(0);
        }
        left -= cur;
        a[i][j] = '*';
      }
    }
    assert(!left);
  }

  if (torev) {
    swap(n, m);
    vector<string> b(n);
    swap(a, b);
    assert(sz(a) == n && sz(b) == m);
    for (int i = 0; i < n; ++i) {
      a[i].resize(m);
      for (int j = 0; j < m; ++j) {
        a[i][j] = b[j][i];
      }
    }
  }

  for (int i = 0; i < n; ++i) {
    assert(sz(a[i]) == m);
    for (int j = 0; j < m; ++j) {
      assert(a[i][j] == '*' || a[i][j] == '.');
    }
  }
  assert(getFunc() == k);
  return 1;
}

void solve() {
  if (!getAns()) {
    printf("-1\n");
    return;
  }
  for (int i = 0; i < n; ++i) {
    printf("%s\n", a[i].c_str());
  }
}

int main() {
  srand(rdtsc());
  precalc();
#ifdef DEBUG
  n = 21742, m = 5, k = 206542;
  getAns();

  int T = 10;
  for (n = 3; n < T; ++n) {
    for (m = 3; m < T; ++m) {
      for (k = 0; k <= (n - 1) * (m - 1) * 4 + 1; ++k) {
        //eprintf("%d %d %d\n", n, m, k);
        if (getAns()) {
          int diff = (n - 1) * (m - 1) * 4 - k;
          if (diff == 4 || diff == 8) {
            eprintf("%d %d %d   -> %d\n", n, m, k, diff);
          }
        }
      }
    }
  }
  for (int iter = 0; iter < 10; ++iter) {
    n = rnd((int) 1e5) + 3, m = rnd((int) 1e5 / n) + 3;
    k = rnd(4 * (n - 1) * (m - 1) + 2);
    //eprintf("%d %d %d\n", n, m, k);
    getAns();
  }
#endif

#ifdef LOCAL
  freopen(TASKNAME".out", "w", stdout);
  assert(freopen(TASKNAME".in", "r", stdin));
#endif

  int t;
  scanf("%d", &t);
  bool first = 1;
  while (1) {
    if (!read()) {
      break;
    }
    if (!first) {
      printf("\n");
    }
    first = 0;
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

namespace input {
    template<class T> void re(complex<T>& x);
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    void re(ld& x) { string t; re(t); x = stold(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T> void re(complex<T>& x) { T a,b; re(a,b); x = cd(a,b); }
    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}

using namespace input;

namespace output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T> void prContain(const T& x) {
        pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; // const needed for vector<bool>
        pr("}");
    }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps(); // no space at end of line
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...); // print w/ spaces
    }
}

using namespace output;

namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
    }
}

using namespace io;

template<class T> T invGeneral(T a, T b) {
    a %= b; if (a == 0) return b == 1 ? 0 : -1;
    T x = invGeneral(b,a);
    return x == -1 ? -1 : ((1-(ll)b*x)/a+b)%b;
}

template<class T> struct modular {
    T val;
    explicit operator T() const { return val; }
    modular() { val = 0; }
    modular(const ll& v) {
        val = (-MOD <= v && v <= MOD) ? v : v % MOD;
        if (val < 0) val += MOD;
    }

    friend ostream& operator<<(ostream& os, const modular& a) { return os << a.val; }
    friend bool operator==(const modular& a, const modular& b) { return a.val == b.val; }
    friend bool operator!=(const modular& a, const modular& b) { return !(a == b); }
    friend bool operator<(const modular& a, const modular& b) { return a.val < b.val; }

    modular operator-() const { return modular(-val); }
    modular& operator+=(const modular& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
    modular& operator-=(const modular& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
    modular& operator*=(const modular& m) { val = (ll)val*m.val%MOD; return *this; }
    friend modular pow(modular a, ll p) {
        modular ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
        return ans;
    }
    friend modular inv(const modular& a) {
        auto i = invGeneral(a.val,MOD); assert(i != -1);
        return i;
    } // equivalent to return exp(b,MOD-2) if MOD is prime
    modular& operator/=(const modular& m) { return (*this) *= inv(m); }

    friend modular operator+(modular a, const modular& b) { return a += b; }
    friend modular operator-(modular a, const modular& b) { return a -= b; }
    friend modular operator*(modular a, const modular& b) { return a *= b; }

    friend modular operator/(modular a, const modular& b) { return a /= b; }
};

typedef modular<int> mi;
typedef pair<mi,mi> pmi;
typedef vector<mi> vmi;
typedef vector<pmi> vpmi;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int t;
vector<string> sol[5][5][37];

int calc(vector<string> v) {
	int res = 0;
	F0R(i,sz(v)-1) F0R(j,sz(v[0])-1) {
		int co = 0;
		F0R(I,2) F0R(J,2) co += v[i+I][j+J] == '*';
		if (co == 4) res += 4;
		if (co == 3) res ++;
	}
	return res;
}

void fin(vector<string> v, int k) {
	assert(calc(v) == k);
	trav(t,v) ps(t);
    ps();
}

vi bad = {1,4,2,5,8};

vector<string> manual(int n, int m, int k) {
    assert(m >= 5);
	vector<string> v(n);
	F0R(i,n) F0R(j,m) v[i] += '.';
    int cur = 0;
    F0R(j,m) v[0][j] = '*';

    pi lst = {0,m-1};
    FOR(i,1,n) F0R(j,m) {
        if (cur+4 > k || (i == n-1 && m-j <= 4)) break;
        v[i][j] = '*'; lst = {i,j};
        if (j == 0) cur ++;
        else if (j == m-1) cur += 3;
        else cur += 4;
    }
    assert(calc(v) == cur);
    int d = k-cur; if (d == 0) return v;
    if (lst.f == n-1 && m-1-lst.s <= 4) {
        if (d == 1) v[n-1][m-1] = '*';
        else if (d == 2) v[n-1][m-3] = '*';
        else if (d == 3) v[n-1][m-1] = '*', v[n-1][m-3] = '*';
        else if (d == 4) v[n-1][lst.s+1] = '*';
        else if (d == 5) v[n-1][lst.s+1] = '*', v[n-1][m-1] = '*';
        else if (d == 6) v[n-1][lst.s+1] = '*', v[n-1][m-2] = '*';
        else if (d == 8) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*';
        else if (d == 9) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*', v[n-1][m-1] = '*';
        else if (d == 12) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*', v[n-1][lst.s+3] = '*';
        else if (d == 15) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*', v[n-1][lst.s+3] = v[n-1][lst.s+4] = '*';
        if (calc(v) != k) {
            ps("AHA",n,m,k,d);
            trav(t,v) ps(t);
            exit(0);
        }
        return v;
    }
    int dd = d;
    if (lst.f == n-1 && d >= 2) {
        v[lst.f][lst.s+2] = '*';
        d -= 2;
    }
    if (lst.s == 0 || (lst.f < n-1 && lst.s == m-1)) {
        int D = 2;
        if (d >= D) {
            if (lst.s == m-1) v[lst.f+1][2] = '*';
            else v[lst.f][2] = '*';
            d -= D;
        }
    }
    if (lst.s != m-1) {
        int D = MOD;
        if (lst.s == m-2) D = 3;
        else D = 1;
        if (d >= D) {
            v[lst.f][m-1] = '*';
            d -= D;
            if (lst.f < n-1) {
                D = 1;
                if (d >= D) {
                    v[lst.f+1][m-1] = v[lst.f+1][m-2] = '*';
                    d -= D;
                }
            }
        }
    } else if (lst.f != n-1) {
        int D = 1;
        if (d >= D) {
            v[lst.f+1][m-1] = '*';
            d -= D;
        }
    }
    if (lst.s != 0 && lst.f != n-1) {
        int D = 1;
        if (d >= D) {
            d -= D;
            v[lst.f+1][0] = '*';
        }
    }
    if (lst.f < n-1 && lst.s > 0 && lst.s < m-1 && v[lst.f][lst.s+1] != '*'
        && v[lst.f+1][lst.s-1] != '*' && v[lst.f+1][lst.s] != '*' && v[lst.f+1][lst.s+1] != '*') {
        int D = 1;
        if (d >= D) {
            d -= D;
            v[lst.f+1][lst.s] = '*';
        }
    }
    // lst.s+2,m-3
    if (calc(v) != k) {
        ps("WUT",n,m,k);
        trav(t,v) ps(t);
        ps(lst,dd,d);
        exit(0);
    }
	return v;
}

vector<string> transpose(vector<string> res) {
	vector<string> RES(sz(res[0]));
	F0R(i,sz(res[0])) F0R(j,sz(res)) RES[i] += res[j][i];
	return RES;
}

vector<string> cool(int m) {
	vector<string> sol(3);
	F0R(i,3) {
		F0R(j,m) sol[i] += '*';
	}
	F0R(i,3) sol[i][0] = '.';
	// ps("HUH",sol); exit(0);
	return sol;
}

void solve(int n, int m, int k) {
	if (max(n,m) < 5) {
		if (sz(sol[n][m][k])) {
			fin(sol[n][m][k],k);
			return;
		}
		ps(-1);
        ps();
		return;
	}
	int dif = 4*(n-1)*(m-1)-k;
	vector<string> res;
	if (dif == 8 && min(n,m) == 3) {
		res = cool(max(n,m));
		if (n != 3) res = transpose(res);
		/*if (n == 5) {
			ps("HUH",res); exit(0);
		}*/
	} else {
		if (dif < 0 || find(all(bad),dif) != bad.end()) {
			ps(-1);
	        ps();
			return;
		}
		if (m >= 5) res = manual(n,m,k);
		else {
			res = transpose(manual(m,n,k));
		}
	}
	assert(sz(res) == n && sz(res[0]) == m);
	fin(res,k);
}

bool vis[5][5];

int xd[4] = {0,1,0,-1}, yd[4] = {1,0,-1,0};

void dfs(int i, int j, vector<string>& g) {
	if (vis[i][j]) return;
	vis[i][j] = 1;
	F0R(z,4) {
		int I = i+xd[z], J = j+yd[z];
		if (I < 0 || I >= sz(g) || J < 0 || J >= sz(g[0])) continue;
		if (g[I][J] == '*') dfs(I,J,g);
	}
}

bool con(vector<string> g) {
	F0R(i,sz(g)) F0R(j,sz(g[0])) vis[i][j] = 0;
	int cur = 0;
	F0R(i,sz(g)) F0R(j,sz(g[0])) if (!vis[i][j] && g[i][j] == '*') {
		dfs(i,j,g); cur ++;
		if (cur > 1) return 0;
	}
	return 1;
}

int main() {
    FOR(n,3,5) FOR(m,3,5) {
    	F0R(z,1<<(n*m)) {
    		vector<string> g(n);
    		F0R(i,n) F0R(j,m) {
    			if (z&(1<<(m*i+j))) g[i] += '*';
    			else g[i] += '.';
    		}
    		if (!con(g)) continue;
    		sol[n][m][calc(g)] = g;
    	}
    }
    // FOR(n,3,9) FOR(m,3,9) F0R(k,4*(n-1)*(m-1)+1) solve(n,m,k);

    setIO(); re(t);
    F0R(i,t) {
        int n,m,k; re(n,m,k);
    	solve(n,m,k);
    }
}

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 100000;

int n, m, K;

vector<int> ret[maxn + 5];

const int walk[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool vis[5][5];
bool g[5][5];

void dfs(int x, int y)
{
	vis[x][y] = 1;
	REP(i, 0, 4)
	{
		int u = x + walk[i][0], v = y + walk[i][1];
		if (u < 0 || u >= n || v < 0 || v >= m) continue;
		if (g[u][v] && !vis[u][v]) dfs(u, v);
	}
}

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d%d%d", &n, &m, &K);
		if (n <= 4 && m <= 4)
		{
			bool find = 0;
			REP(i, 1, (1 << (n * m)))
			{
				REP(j, 0, n) REP(k, 0, m) g[j][k] = (i >> (j * m + k) & 1);
				int cnt = 0;
				memset(vis, 0, sizeof vis);
				REP(j, 0, n) REP(k, 0, m) if (g[j][k] && !vis[j][k]) dfs(j, k), ++cnt;
				if (cnt > 1) continue;
				int tot = 0;
				REP(j, 0, n - 1) REP(k, 0, m - 1)
				{
					int tmp = g[j][k] + g[j + 1][k] + g[j][k + 1] + g[j + 1][k + 1];
					if (tmp == 3) ++tot;
					else if (tmp == 4) tot += 4;
				}
				if (tot == K)
				{
					find = 1;
					REP(j, 0, n)
					{
						REP(k, 0, m)
						{
							if (g[j][k]) putchar('*');
							else putchar('.');
						}
						putchar('\n');
					}
					putchar('\n');
					break;
				}
			}
			if (!find) puts("-1\n");
			continue;
		}
		if (K > ((n - 1) * (m - 1) << 2))
		{
			puts("-1\n");
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2))
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar('*');
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2) - 8)
		{
			if (n == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!j ? '.' : '*');
					putchar('\n');
				}
			}
			else if (m == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!i ? '.' : '*');
					putchar('\n');
				}
			}
			else puts("-1");
			putchar('\n');
			continue;
		}
		else if (!K)
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((!i && !j ? '*' : '.'));
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		bool rev = 0;
		if (n > m) swap(n, m), rev = 1;
		REP(i, 0, n) ret[i] = vector<int>(m, 0);
		bool failed = 0;
		--K;
		REP(i, 0, m) ret[0][i] = 1;
		int px = 0, py = m - 1;
		REP(i, 1, n) REP(j, 1, m)
		{
			if (K < 4) break;
			px = i, py = j;
			ret[i][j] = 1;
			K -= 4;
		}
		if (py == m - 1) ++px, py = 0;
		REP(i, 0, px + 1) ret[i][0] = 1;
		if (K == 1)
		{
			if (px != n - 1)
			{
				if (py >= 1) ret[px + 1][0] = 1;
				else ret[px][m - 1] = 1;
			}
			else if (py < m - 2) ret[n - 1][m - 1] = 1;
			else failed = 1;
		}
		else if (K == 2)
		{
			if (px != n - 1)
			{
				if (py >= 2) ret[px + 1][1] = 1;
				else ret[px][m - 2] = 1;
			}
			else if (py < m - 3) ret[px][m - 2] = 1;
			else failed = 1;
		}
		else if (K == 3)
		{
			if (px != n - 1)
			{
				if (py >= 3) ret[px + 1][0] = ret[px + 1][py - 1] = 1;
				else if (py == 2) ret[px + 1][1] = ret[px][m - 1] = 1;
				else if (py == 1) ret[px + 1][0] = ret[px][m - 2] = 1;
				else ret[px][m - 3] = ret[px][m - 1] = 1;
			}
			else if (py < m - 4) ret[px][m - 3] = ret[px][m - 1] = 1;
			else failed = 1;
		}
		if (rev) swap(n, m);
		if (failed)
		{
			puts("-1");
		}
		else
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((rev ? ret[j][i] : ret[i][j]) ? '*' : '.');
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;
#define MAX 100035
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    x+=y; if (x>=mod) x-=mod;
    assert(x>=0 && x<mod);
}
void et() {
    puts("-1"); exit(0);
}

vector<int> A[MAX];
void fmain() {
    scanf("%d%d%d", &n, &m, &k);
    bool  fg = 0, fd=0;
    if (n<m) {
        fg=1; swap(n,m);
    }
    for(int i=0;i<=n+1;i++) {
        A[i].resize(m+2,0);
    }
    for(int s=1;s<=m;s++) {
        for(int i=0;i<=n+1;i++)  A[i].assign(m+2, 0);

        for(int j=1;j<=s;j++) A[1][j]=1;
        int cnt = 0;
        for(int i=2;i<=n;i++) {
            REQ(j,m) {
                int cc=0;
                if (A[i][j-1]==1 && A[i-1][j-1]==1) cc++;
                if (A[i][j-1]==1 && A[i-1][j]==1) cc++;
                if (A[i-1][j]==1 && A[i-1][j-1]==1) cc++;
                if (A[i-1][j]==1 && A[i-1][j+1]==1) cc++;
                if (cnt+cc<=k &&  (A[i][j-1]==1 || A[i-1][j]==1)) {
                    cnt+=cc; A[i][j]=1;
                    //cout<<i<<" "<<j<<" "<<cc<<endl;
                }
            }
        }
        if (cnt==k) {
            fd=1; break;
        }
    }
    if (!fd) puts("-1");
    else {
        if (!fg) {
            REQ(i,n) {
                REQ(j,m) printf("%c", A[i][j] ? '*' : '.');
                puts("");
            }
        } else {
            REQ(j,m) {
                REQ(i,n) printf("%c", A[i][j] ? '*' : '.');
                puts("");
            }
        }
    }
    puts("");
}
int main() {
    int t=1; scanf("%d", &t);
    while(t--)fmain();
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=1;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    bool iv=0;
    if(n<5&&m<5)
    {
        if(!hasans[n][m][K])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar(i+j==2?'*':'.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(n>m)swap(n,m),iv=1;
    if(n==3&&m>=5&&K==8*(m-2))
    {
        if(!iv)
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        else
        for(int i=1;i<=m;i++)
        {
            for(int j=1;j<=n;j++)putchar(i==1?'.':'*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else if(fy==2)flag[fx+1][1]=1,flag[fx][m-1]=1;
                    else flag[fx][3]=1,flag[fx][m]=1;
                }
                goto output;
            }
            else if(K<4||(i==n&&fy==m-5))
            {
                for(int k=0;k<32;k++)
                {
                    for(int l=0;l<5;l++)flag[i][m-l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    if(!iv)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    else
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            putchar(flag[j][i]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
bool __barr[550055], *__pbarr=__barr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }
inline bool* newbool(const unsigned int SZ) {
	__pbarr += SZ;
	return __pbarr - SZ;
}
inline void initbool() { __pbarr=__barr; }
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

char DB[5][5][37][4][4];

char *A[100005];
bool *chk[100005];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void dfs(int y, int x) {
	chk[y][x] = true;
	for(int dr = 0; dr < 4; dr++) {
		int ny = y+dy[dr], nx = x+dx[dr];
		if('*' != A[ny][nx] || chk[ny][nx]) continue;
		dfs(ny, nx);
	}
}
bool isConnected(int H, int W) {
	initbool();
	for(int i = 0; i <= H+1; i++)
		chk[i] = newbool(W+2);
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	bool flag = false;
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++) {
			if('*' == A[i][j]) {
				flag = true;
				dfs(i, j);
				break;
			}
		}
		if(flag) break;
	}

	if(!flag) return false;

	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('*' == A[i][j] && !chk[i][j]) return false;
	return true;
}

void printAnswer(int H, int W) {
	initbool();
	for(int i = 0; i <= H+1; i++)
		chk[i] = newbool(W+2);
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	dfs(1, 1);

	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar('*' == A[i][j] && chk[i][j] ? '*' : '.');
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i <= h+1; i++)
				fill(A[i], A[i]+w+2, '.');
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);
			if(!isConnected(h, w)) continue;

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if((H-1)*(W-1)*4 < N) {
			puts("-1");
			continue;
		}
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		if((H-1) * (W-2) * 4 == N) {
			for(int i = 1; i <= H; i++) {
				for(int j = 1; j < W; j++)
					putchar('*');
				puts(".");
			}
			continue;
		}

		if((H-2) * (W-1) * 4 == N) {
			for(int i = 1; i < H; i++) {
				for(int j = 1; j <= W; j++)
					putchar('*');
				puts("");
			}
			for(int j = 1; j <= W; j++)
				putchar('.');
			puts("");
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						bool iscon = true, niscon = true;

						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;
							if('*' != A[i-1][j+k] && '*' != A[i][j+k-1]) iscon = false;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
						}

						if(sum+nsum == N && iscon && niscon && isConnected(H, W)) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0; niscon = true;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;
							if('*' != A[i-1][W] && '*' != A[i][W-1]) iscon = false;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
								if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
							}

							if(sum+nsum == N && iscon && niscon && isConnected(H, W)) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<sstream>
#include<numeric>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
#define For(i,x,y) for(int i=x,_y=y;i<=_y;++i)
#define Rep(i,x,y) for(int i=x,_y=y;i>=_y;--i)
#define pub push_back
#define pob pop_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
inline int read()
{
	int x=0,c=getchar(),f=0;
	for(;c>'9'||c<'0';f=c=='-',c=getchar());
	for(;c>='0'&&c<='9';x=(x<<1)+(x<<3)+c-'0',c=getchar());
	return f?-x:x;
}
inline void write(int x)
{
	if(x<0)putchar('-'),x=-x;
	if(x>=10)write(x/10);
	putchar(x%10+48);
}
int n,m,k,a[100005][500];
int main()
{
	for(int test=read();test--;)
	{
		n=read(),m=read(),k=read();
		bool flag=0;
		if(n<m)swap(n,m),flag=1;
		For(i,1,m)
		{
			For(x,0,n+1)For(y,0,m+1)a[x][y]=0;
			int cnt=0;
			For(y,1,i)a[1][y]=1;
			For(x,2,n)For(y,1,m)
			{
				int ad=a[x-1][y]*a[x][y-1]+a[x-1][y-1]*a[x][y-1]+a[x-1][y]*(a[x-1][y-1]+a[x-1][y+1]);
				if(cnt+ad<=k&&(a[x-1][y]||a[x][y-1]))cnt+=ad,a[x][y]=1;
			}
			if(cnt==k)goto YES;
		}
		puts("-1\n");continue;
		YES:;
		if(flag)
			For(y,1,m)
			{
				For(x,1,n)putchar(a[x][y]?'*':'.');
				puts("");
			}
		else
			For(x,1,n)
			{
				For(y,1,m)putchar(a[x][y]?'*':'.');
				puts("");
			}
		puts("");
	}
}

#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=1;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    bool iv=0;
    if(n<5&&m<5)
    {
        if(!hasans[n][m][K])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(n==3&&m>=5&&K==8*(m-2))
    {
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar(i+j==2?'*':'.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(n>m)swap(n,m),iv=1;
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else if(fy==2)flag[fx+1][1]=1,flag[fx][m-1]=1;
                    else flag[fx][3]=1,flag[fx][m]=1;
                }
                goto output;
            }
            else if(K<4||(i==n&&fy==m-5))
            {
                for(int k=0;k<32;k++)
                {
                    for(int l=0;l<5;l++)flag[i][j+l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    if(!iv)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    else
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            putchar(flag[j][i]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

char DB[5][5][37][4][4];

char *A[100005];
bool chk[10][10];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void dfs(int y, int x) {
	chk[y][x] = true;
	for(int dr = 0; dr < 4; dr++) {
		int ny = y+dy[dr], nx = x+dx[dr];
		if('*' != A[ny][nx] || chk[ny][nx]) continue;
		dfs(ny, nx);
	}
}
bool isConnected(int H, int W) {
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	bool flag = false;
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++) {
			if('*' == A[i][j]) {
				flag = true;
				dfs(i, j);
				break;
			}
		}
		if(flag) break;
	}

	if(!flag) return false;

	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('*' == A[i][j] && !chk[i][j]) return false;
	return true;
}

void printAnswer(int H, int W) {
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar(A[i][j]);
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);
			if(!isConnected(h, w)) continue;

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		if((H-1) * (W-2) * 4 == N) {
			for(int i = 1; i <= H; i++) {
				for(int j = 1; j < W; j++)
					putchar('*');
				puts(".");
			}
			continue;
		}

		if((H-2) * (W-1) * 4 == N) {
			for(int i = 1; i < H; i++) {
				for(int j = 1; j <= W; j++)
					putchar('*');
				puts("");
			}
			for(int j = 1; j <= W; j++)
				putchar('.');
			puts("");
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						bool iscon = true, niscon = true;

						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;

							if('*' != A[i-1][j+k] && '*' == A[i][j+k-1]) iscon = false;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
						}

						if(sum+nsum == N && iscon && niscon) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0; niscon = true;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;
							if('*' != A[i-1][W] && '*' != A[i][W-1]) iscon = false;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
								if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
							}

							if(sum+nsum == N && iscon && niscon) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 200005;
const ld PI = 4*atan((ld)1);

template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }

namespace input {
    template<class T> void re(complex<T>& x);
    template<class T1, class T2> void re(pair<T1,T2>& p);
    template<class T> void re(vector<T>& a);
    template<class T, size_t SZ> void re(array<T,SZ>& a);

    template<class T> void re(T& x) { cin >> x; }
    void re(double& x) { string t; re(t); x = stod(t); }
    void re(ld& x) { string t; re(t); x = stold(t); }
    template<class Arg, class... Args> void re(Arg& first, Args&... rest) {
        re(first); re(rest...);
    }

    template<class T> void re(complex<T>& x) { T a,b; re(a,b); x = cd(a,b); }
    template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
    template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
    template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}

using namespace input;

namespace output {
    template<class T1, class T2> void pr(const pair<T1,T2>& x);
    template<class T, size_t SZ> void pr(const array<T,SZ>& x);
    template<class T> void pr(const vector<T>& x);
    template<class T> void pr(const set<T>& x);
    template<class T1, class T2> void pr(const map<T1,T2>& x);

    template<class T> void pr(const T& x) { cout << x; }
    template<class Arg, class... Args> void pr(const Arg& first, const Args&... rest) {
        pr(first); pr(rest...);
    }

    template<class T1, class T2> void pr(const pair<T1,T2>& x) {
        pr("{",x.f,", ",x.s,"}");
    }
    template<class T> void prContain(const T& x) {
        pr("{");
        bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; // const needed for vector<bool>
        pr("}");
    }
    template<class T, size_t SZ> void pr(const array<T,SZ>& x) { prContain(x); }
    template<class T> void pr(const vector<T>& x) { prContain(x); }
    template<class T> void pr(const set<T>& x) { prContain(x); }
    template<class T1, class T2> void pr(const map<T1,T2>& x) { prContain(x); }

    void ps() { pr("\n"); }
    template<class Arg> void ps(const Arg& first) {
        pr(first); ps(); // no space at end of line
    }
    template<class Arg, class... Args> void ps(const Arg& first, const Args&... rest) {
        pr(first," "); ps(rest...); // print w/ spaces
    }
}

using namespace output;

namespace io {
    void setIn(string s) { freopen(s.c_str(),"r",stdin); }
    void setOut(string s) { freopen(s.c_str(),"w",stdout); }
    void setIO(string s = "") {
        ios_base::sync_with_stdio(0); cin.tie(0); // fast I/O
        if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
    }
}

using namespace io;

template<class T> T invGeneral(T a, T b) {
    a %= b; if (a == 0) return b == 1 ? 0 : -1;
    T x = invGeneral(b,a);
    return x == -1 ? -1 : ((1-(ll)b*x)/a+b)%b;
}

template<class T> struct modular {
    T val;
    explicit operator T() const { return val; }
    modular() { val = 0; }
    modular(const ll& v) {
        val = (-MOD <= v && v <= MOD) ? v : v % MOD;
        if (val < 0) val += MOD;
    }

    friend ostream& operator<<(ostream& os, const modular& a) { return os << a.val; }
    friend bool operator==(const modular& a, const modular& b) { return a.val == b.val; }
    friend bool operator!=(const modular& a, const modular& b) { return !(a == b); }
    friend bool operator<(const modular& a, const modular& b) { return a.val < b.val; }

    modular operator-() const { return modular(-val); }
    modular& operator+=(const modular& m) { if ((val += m.val) >= MOD) val -= MOD; return *this; }
    modular& operator-=(const modular& m) { if ((val -= m.val) < 0) val += MOD; return *this; }
    modular& operator*=(const modular& m) { val = (ll)val*m.val%MOD; return *this; }
    friend modular pow(modular a, ll p) {
        modular ans = 1; for (; p; p /= 2, a *= a) if (p&1) ans *= a;
        return ans;
    }
    friend modular inv(const modular& a) {
        auto i = invGeneral(a.val,MOD); assert(i != -1);
        return i;
    } // equivalent to return exp(b,MOD-2) if MOD is prime
    modular& operator/=(const modular& m) { return (*this) *= inv(m); }

    friend modular operator+(modular a, const modular& b) { return a += b; }
    friend modular operator-(modular a, const modular& b) { return a -= b; }
    friend modular operator*(modular a, const modular& b) { return a *= b; }

    friend modular operator/(modular a, const modular& b) { return a /= b; }
};

typedef modular<int> mi;
typedef pair<mi,mi> pmi;
typedef vector<mi> vmi;
typedef vector<pmi> vpmi;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int t;
vector<string> sol[5][5][37];

int calc(vector<string> v) {
	int res = 0;
	F0R(i,sz(v)-1) F0R(j,sz(v[0])-1) {
		int co = 0;
		F0R(I,2) F0R(J,2) co += v[i+I][j+J] == '*';
		if (co == 4) res += 4;
		if (co == 3) res ++;
	}
	return res;
}

void fin(vector<string> v, int k) {
	assert(calc(v) == k);
	trav(t,v) ps(t);
    ps();
}

vi bad = {1,4,2,5,8};

vector<string> manual(int n, int m, int k) {
    assert(m >= 5);
	vector<string> v(n);
	F0R(i,n) F0R(j,m) v[i] += '.';
    int cur = 0;
    F0R(j,m) v[0][j] = '*';

    pi lst = {0,m-1};
    FOR(i,1,n) F0R(j,m) {
        if (cur+4 > k || (i == n-1 && m-j <= 4)) break;
        v[i][j] = '*'; lst = {i,j};
        if (j == 0) cur ++;
        else if (j == m-1) cur += 3;
        else cur += 4;
    }
    assert(calc(v) == cur);
    int d = k-cur; if (d == 0) return v;
    if (lst.f == n-1 && m-1-lst.s <= 4) {
        if (d == 1) v[n-1][m-1] = '*';
        else if (d == 2) v[n-1][m-3] = '*';
        else if (d == 3) v[n-1][m-1] = '*', v[n-1][m-3] = '*';
        else if (d == 4) v[n-1][lst.s+1] = '*';
        else if (d == 5) v[n-1][lst.s+1] = '*', v[n-1][m-1] = '*';
        else if (d == 6) v[n-1][lst.s+1] = '*', v[n-1][m-2] = '*';
        else if (d == 8) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*';
        else if (d == 9) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*', v[n-1][m-1] = '*';
        else if (d == 12) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*', v[n-1][lst.s+3] = '*';
        else if (d == 15) v[n-1][lst.s+1] = '*', v[n-1][lst.s+2] = '*', v[n-1][lst.s+3] = v[n-1][lst.s+4] = '*';
        if (calc(v) != k) {
            ps("AHA",n,m,k,d);
            trav(t,v) ps(t);
            exit(0);
        }
        return v;
    }
    int dd = d;
    if (lst.f == n-1 && d >= 2) {
        v[lst.f][lst.s+2] = '*';
        d -= 2;
    }
    if (lst.s == 0 || (lst.f < n-1 && lst.s == m-1)) {
        int D = 2;
        if (d >= D) {
            if (lst.s == m-1) v[lst.f+1][2] = '*';
            else v[lst.f][2] = '*';
            d -= D;
        }
    }
    if (lst.s != m-1) {
        int D = MOD;
        if (lst.s == m-2) D = 3;
        else D = 1;
        if (d >= D) {
            v[lst.f][m-1] = '*';
            d -= D;
            if (lst.f < n-1) {
                D = 1;
                if (d >= D) {
                    v[lst.f+1][m-1] = v[lst.f+1][m-2] = '*';
                    d -= D;
                }
            }
        }
    } else if (lst.f != n-1) {
        int D = 1;
        if (d >= D) {
            v[lst.f+1][m-1] = '*';
            d -= D;
        }
    }
    if (lst.s != 0 && lst.f != n-1) {
        int D = 1;
        if (d >= D) {
            d -= D;
            v[lst.f+1][0] = '*';
        }
    }
    if (lst.f < n-1 && lst.s > 0 && lst.s < m-1 && v[lst.f][lst.s+1] != '*'
        && v[lst.f+1][lst.s-1] != '*' && v[lst.f+1][lst.s] != '*' && v[lst.f+1][lst.s+1] != '*') {
        int D = 1;
        if (d >= D) {
            d -= D;
            v[lst.f+1][lst.s] = '*';
        }
    }
    // lst.s+2,m-3
    if (calc(v) != k) {
        ps("WUT",n,m,k);
        trav(t,v) ps(t);
        ps(lst,dd,d);
        exit(0);
    }
	return v;
}

void solve(int n, int m, int k) {
	if (max(n,m) < 5) {
		if (sz(sol[n][m][k])) {
			fin(sol[n][m][k],k);
			return;
		}
		ps(-1);
        ps();
		return;
	}
	int dif = 4*(n-1)*(m-1)-k;
	if (dif < 0 || find(all(bad),dif) != bad.end()) {
		ps(-1);
        ps();
		return;
	}
	vector<string> res;
	if (m >= 5) res = manual(n,m,k);
	else {
		res = manual(m,n,k);
		vector<string> RES(n);
		F0R(i,n) F0R(j,m) RES[i] += res[j][i];
		swap(res,RES);
	}
	assert(sz(res) == n && sz(res[0]) == m);
	fin(res,k);
}

bool vis[5][5];

int xd[4] = {0,1,0,-1}, yd[4] = {1,0,-1,0};

void dfs(int i, int j, vector<string>& g) {
	if (vis[i][j]) return;
	vis[i][j] = 1;
	F0R(z,4) {
		int I = i+xd[z], J = j+yd[z];
		if (I < 0 || I >= sz(g) || J < 0 || J >= sz(g[0])) continue;
		if (g[I][J] == '*') dfs(I,J,g);
	}
}

bool con(vector<string> g) {
	F0R(i,sz(g)) F0R(j,sz(g[0])) vis[i][j] = 0;
	int cur = 0;
	F0R(i,sz(g)) F0R(j,sz(g[0])) if (!vis[i][j] && g[i][j] == '*') {
		dfs(i,j,g); cur ++;
		if (cur > 1) return 0;
	}
	return 1;
}

int main() {
    FOR(n,3,5) FOR(m,3,5) {
    	F0R(z,1<<(n*m)) {
    		vector<string> g(n);
    		F0R(i,n) F0R(j,m) {
    			if (z&(1<<(m*i+j))) g[i] += '*';
    			else g[i] += '.';
    		}
    		if (!con(g)) continue;
    		sol[n][m][calc(g)] = g;
    	}
    }
    // FOR(n,3,9) FOR(m,3,9) F0R(k,4*(n-1)*(m-1)+1) solve(n,m,k);

    setIO(); re(t);
    F0R(i,t) {
        int n,m,k; re(n,m,k);
    	solve(n,m,k);
    }
}

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do smth instead of nothing and stay organized
*/

#include <iostream>
#include <vector>

using namespace std;

int n,m,k;
vector<vector<int> > v;
bool transponer;

void escribe()
{
  if (transponer) {
    vector<vector<int> > nextv(m+2,vector<int> (n+2,0));
    for (int i=1;i<=n;i++)
      for (int j=1;j<=m;j++)
	nextv[j][i]=v[i][j];
    swap(n,m);
    v=nextv;
  }
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++)
      if (v[i][j]) cout<<"*";
      else cout<<".";
    cout<<endl;
  }
}

int valor(int i,int j)
{
  if (i==1) return 0;
  if (j==1) return 1;
  if (j==m) return 3;
  return 4;
}

void genera()
{
  int act=0;
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++) {
      if (act+valor(i,j)>k) {
	int resta=k-act;
	if (resta==1) {
	  if (m>j) v[i][m]=1;
	  else v[i+1][1]=1;
	} else if (resta==2) {
	  if (m-j+1>=3) v[i][m-1]=1;
	  else if (m-j+1==2) v[i][m]=v[i+1][m]=v[i+1][m-1]=1;
	  else v[i+1][2]=1;
	} else {
	  // resta==3.
	  if (m-j+1>=4) v[i][m]=v[i][m-2]=1;
	  else if (j==2) v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=v[i+1][2]=1;
	  else v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=1;
	}
	escribe();
	return;
      }
      v[i][j]=1;
      act+=valor(i,j);
      if (act==k) {
	escribe();
	return;
      }
    }
  }
}

int main()
{
  ios::sync_with_stdio(false);
  int casos;
  cin>>casos;
  for (int cas=0;cas<casos;cas++) {
    if (cas>0) cout<<endl;
    cin>>n>>m>>k;
    transponer=false;
    if (n>m) {
      swap(n,m);
      transponer=true;
    }
    v=vector<vector<int> > (n+2,vector<int> (m+2,0));
    int total=(n-1)+(n-1)*(m-2)*4+(n-1)*3;
    if (k>total or k==total-1 or k==total-2 or k==total-4 or k==total-5) {
      cout<<-1<<endl;
      continue;
    }
    if (k==total-8) {
      if (n>3) {
	cout<<-1<<endl;
	continue;
      }
      for (int i=1;i<=n;i++)
	for (int j=1;j<=m-1;j++)
	  v[i][j]=1;
      escribe();
      continue;
    }
    if (m==3 and k==6) {
      for (int i=1;i<=3;i++)
	for (int j=1;j<=3;j++)
	  v[i][j]=1;
      v[1][1]=v[2][1]=v[1][2]=0;
      escribe();
      continue;
    }
    genera();
  }
}

#include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <list>
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;

#define PB push_back
#define MP make_pair
#define SZ(v) ((int)(v).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n) FORE(i,0,n)
#define FORSZ(i,a,v) FOR(i,a,SZ(v))
#define REPSZ(i,v) REP(i,SZ(v))
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=100000;

int h,w,n,want;
bool haveret; char ret[MAXN+1],nret[MAXN+1];

void bf() {
	REP(msk,1<<n) {
		int cur=0;
		REP(x,h-1) REP(y,w-1) {
			int cnt=0;
			REP(dx,2) REP(dy,2) if((msk>>((x+dx)*w+(y+dy)))&1) ++cnt;
			if(cnt==3) ++cur; if(cnt==4) cur+=4;
		}
		if(cur==want) { haveret=true; REP(j,n) ret[j]=(msk>>j)&1?'*':'.'; return; }
	}
}

void greedy() { // w>=5
	if(h==2&&want==(w-2)*4) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=0<=y&&y<w-1?'*':'.'; return; }
	if(h==2&&want==(w-3)*4) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=1<=y&&y<w-1?'*':'.'; return; }
	if(h==3&&want==(w-2)*8) { haveret=true; REP(x,h) REP(y,w) ret[x*w+y]=0<=y&&y<w-1?'*':'.'; return; }

	int left=want; REP(x,h) REP(y,w) ret[x*w+y]=x==0?'*':'.';
	int x,y;
	for(x=1;x<h;++x) {
		for(y=0;y<w;++y) {
			if(left<=3||x==h-1&&w-y==4) break;
			ret[x*w+y]='*'; left-=y==0?1:y==w-1?3:4;
		}
		if(left<=3||x==h-1&&w-y==4) break;
	}
	if(x==h-1&&w-y==4) {
		REP(msk,1<<4) {
			int cur=0;
			REP(yy,4) {
				int cnt=0;
				REP(dy,2) if(yy+dy==0||(msk>>(yy+dy-1)&1)) ++cnt;
				if(cnt==1) ++cur; if(cnt==2) cur+=4;
			}
			if(cur-1==left) { haveret=true; REP(j,4) ret[x*w+y+j]=(msk>>j)&1?'*':'.'; return; }
		}
	}
	if(left<=3) {
		int dy=w-y; //printf("left=%d dy=%d\n",left,dy);
		int y1=dy==2||dy>=4?w-1:0;
		int y2=dy==3?w-2:dy>=4?w-3:dy==2?1:2;
		if(left&1) ret[(x+(y1<y?1:0))*w+y1]='*';
		if(left&2) ret[(x+(y2<y?1:0))*w+y2]='*';
		haveret=true;
	}
}

void run() {
	scanf("%d%d%d",&h,&w,&want); n=h*w; haveret=false;
	if(h<=4&&w<=4) {
		bf();
	} else {
		bool swp=w<h;
		if(swp) swap(w,h);
		greedy();
		if(swp) { swap(w,h); REP(x,h) REP(y,w) nret[x*w+y]=ret[y*h+x]; REP(i,n) ret[i]=nret[i]; }
	}
	if(!haveret) printf("-1\n"); else REP(x,h) { REP(y,w) printf("%c",ret[x*w+y]); puts(""); }
}

int main() {
	int n; scanf("%d",&n); FORE(i,1,n) { if(i!=1) puts(""); run(); }
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=1;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    bool iv=0;
    if(n<5&&m<5)
    {
        if(!hasans[n][m][K])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(n==3&&m>=5&&K==2*(m-1)+8)
    {
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar(i+j==2?'*':'.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(n>m)swap(n,m),iv=1;
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else flag[fx+1][1]=1,flag[fx][m-1]=1;
                }
                goto output;
            }
            else if(K<4||(i==n&&fy==m-5))
            {
                for(int k=0;k<32;k++)
                {
                    for(int l=0;l<5;l++)flag[i][j+l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    if(!iv)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    else
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            putchar(flag[j][i]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int X1[4]={0,0,0,0};
int Y1[4]={-1,-1,1,1};
int X2[4]={-1,1,-1,1};
int Y2[4]={0,0,0,0};
int X[4]={0,0,1,-1};
int Y[4]={1,-1,0,0};
int i,j,k,n,m,x,y,T,Cnt,xx,yy;
bool f,F,f2;
map<int,bool>b[200010],a[200010];
inline int Calc(int x,int y){
	int Ans=0;
	for(int p=0;p<4;p++){
		int xx=x+X1[p],yy=y+Y1[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		xx=x+X2[p];yy=y+Y2[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		Ans++;
	}
	return Ans;
}
inline void Dfs(int x,int y,int Sum){
	if(++Cnt>(n*m*10)||f||Sum>k)return;
	if(Sum==k){
		f=1;
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)a[i][j]=b[i][j];
		return;
	}
	if(y==m+1)x++,y=1;
	if(x==n+1)return;
	bool f3=0;
	for(int p=0;p<4;p++){
		xx=x+X[p];yy=y+Y[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		f3=1;break;
	}
	if(!f2||f3){
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum-=Calc(xx,yy);
		}
		int s=Sum;
		b[x][y]=1;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum+=Calc(xx,yy);
		}
		Dfs(x,y+1,Sum+Calc(x,y));
		f2=1;
		b[x][y]=0;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			s+=Calc(xx,yy);
		}
		Dfs(x,y+1,s);
	}else{
		b[x][y]=0;
		Dfs(x,y+1,Sum);
	}
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&k);
		F=0;
		if(n<m)swap(n,m),F=1;
		f=Cnt=f2=0;Dfs(1,1,0);
		if(f){
			if(F)
			for(i=1;i<=m;i++){
				for(j=1;j<=n;j++)
				if(a[j][i])putchar('*');else putchar('.');
				putchar('\n');
			}else
			for(i=1;i<=n;i++){
				for(j=1;j<=m;j++)
				if(a[i][j])putchar('*');else putchar('.');
				putchar('\n');
			}
		}else puts("-1");
		putchar('\n');
	}
	return 0;
}

#include<bits/stdc++.h>
typedef long long ll;
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
std::vector<std::string>ans;
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int t=gi();
	while(t--){
		int n=gi(),m=gi(),swp=0;ll k=gi();
		if(n==3)swp=1,std::swap(n,m);
		ans=std::vector<std::string>(n,std::string(m,'.'));
		ans[0]=std::string(m,'*');
		bool nosol=0;
		for(int i=1;k&&i<n;++i)
			for(int j=0;k&&j<m;++j){
				int s=!j?1:3+(j<m-1);
				if(k>=s)k-=s,ans[i][j]='*';
				else{
					if(j==m-1){
						if(i==n-1)nosol=1;
						else ans[i+1][m-2]='*',ans[i+1][m-1]=(k==2?'*':'.');
					}else if(k==1)ans[i][m-1]='*';
					else if(j==m-2){
						if(i==n-1)nosol=1;
						else ans[i][m-1]=ans[i+1][m-2]=ans[i+1][m-3]='*',ans[i+1][m-1]=(k==3?'*':'.');
					}else if(k==2)ans[i][m-2]='*';
					else if(j==m-3){
						if(i==n-1)nosol=1;
						else ans[i][m-2]=ans[i+1][m-2]=ans[i+1][m-1]='*';
					}else ans[i][m-1]=ans[i][m-3]='*';
					k=0;
				}
			}
		if(nosol||k)puts("-1");
		else{
			if(swp)std::swap(n,m);
			for(int i=0;i<n;++i){for(int j=0;j<m;++j)putchar(swp?ans[j][i]:ans[i][j]);puts("");}
			if(t)puts("");
		}
	}
	return 0;
}

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cassert>
#include <ctime>
#include <string>
#include <queue>

using namespace std;

#ifdef _WIN32
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif

typedef long double ld;
typedef long long ll;

long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}

inline int myrand() {
#ifdef _WIN32
  return abs((rand() << 15) ^ rand());
#else
  return rand();
#endif
}

inline int rnd(int x) {
  return myrand() % x;
}

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())
#define TASKNAME "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1.0);

void precalc() {
}

int n, m, k;

int read() {
  if (scanf("%d%d%d", &n, &m, &k) < 3) {
    return 0;
  }
  return 1;
}

const int maxn = (int) 1e5 + 10;
vector<string> a;

const int gox[] = {1, 0, -1, 0}, goy[] = {0, 1, 0, -1};

vector<vector<bool> > used;

bool ok(int x, int y) {
  return 0 <= x && x < n && 0 <= y && y < m;
}

int dfs(int x, int y) {
  used[x][y] = 1;
  int res = 1;
  for (int dir = 0; dir < 4; ++dir) {
    int nx = x + gox[dir], ny = y + goy[dir];
    if (ok(nx, ny) && a[nx][ny] == '*' && !used[nx][ny]) {
      res += dfs(nx, ny);
    }
  }
  return res;
}

const int K = 5;

int getFunc() {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (a[i][j] == '*') {
        used = vector<vector<bool> >(n, vector<bool>(m, 0));
        int cnt = dfs(i, j);
        int want = 0;
        for (int r = 0; r < n; ++r) {
          want += count(a[r].begin(), a[r].end(), '*');
        }
        if (want != cnt) {
          return -1;
        }
        int res = 0;
        for (int i = 0; i < n - 1; ++i) {
          for (int j = 0; j < m - 1; ++j) {
            int cnt = (a[i][j] == '*') + (a[i + 1][j] == '*') + (a[i][j + 1] == '*') + (a[i + 1][j + 1] == '*');
            if (cnt == 3) {
              ++res;
            }
            if (cnt == 4) {
              res += 4;
            }
          }
        }
        return res;
      }
    }
  }
  return -1;
}

bool getAns() {
  if (n < K && m < K) {
    int cnt = n * m;
    a.resize(n);
    for (int mask = 0; mask < (1 << cnt); ++mask) {
      for (int i = 0; i < n; ++i) {
        a[i].resize(m);
        for (int j = 0; j < m; ++j) {
          a[i][j] = ((mask >> (i * m + j)) & 1) ? '*' : '.';
        }
      }
      if (getFunc() == k) {
        return 1;
      }
    }
    return 0;
  }

  int mx = (n - 1) * (m - 1) * 4;
  if (k > mx || k == mx - 1 || k == mx - 2 || k == mx - 4 || k == mx - 5 || k == mx - 8) {
    return 0;
  }

  bool torev = 0;
  if (n > m) {
    torev = 1;
    swap(n, m);
  }

  for (int i = 0; i < n; ++i) {
    a[i] = string(m, !i ? '*' : '.');
  }

  int left = k;
  for (int i = 1; i < n && left > 0; ++i) {
    if (left < 5) {
      if (left >= 2) {
        a[i][2] = '*';
        left -= 2;
      }
      if (left >= 1) {
        a[i][0] = '*';
        left -= 1;
      }
      if (left >= 1) {
        a[i][m - 1] = '*';
        left -= 1;
      }
      break;
    }
    a[i][0] = a[i][1] = '*';
    left -= 5;
    for (int j = 2; j < m && left > 0; ++j) {
      int cur = (j == m - 1 ? 3 : 4);
      if (left < cur) {
        if (cur == 4) {
          if (left == 1) {
            a[i].back() = '*';
            --left;
            break;
          }
          if (left == 2) {
            if (j < m - 2) {
              a[i][j + 1] = '*';
            } else {
              assert(i + 1 < n);
              a[i + 1][1] = '*';
            }
            left -= 2;
            break;
          }
          if (left == 3) {
            if (j < m - 3) {
              a[i][j + 1] = a[i][m - 1] = '*';
            } else {
              if (j == m - 3) {
                assert(i + 1 < n);
                a[i][m - 2] = a[i + 1][0] = '*';
              } else {
                assert(j == m - 2);
                assert(i + 1 < n);
                a[i][m - 1] = a[i + 1][1] = '*';
              }
            }
            left -= 3;
            break;
          }
        } else {
          assert(i + 1 < n);
          a[i + 1][left - 1] = '*';
          left = 0;
          break;
        }
        assert(0);
      }
      left -= cur;
      a[i][j] = '*';
    }
  }
  assert(!left);

  if (torev) {
    swap(n, m);
    vector<string> b(n);
    swap(a, b);
    for (int i = 0; i < n; ++i) {
      a[i].resize(m);
      for (int j = 0; j < m; ++j) {
        a[i][j] = b[j][i];
      }
    }
  }

  for (int i = 0; i < n; ++i) {
    assert(sz(a[i]) == m);
    for (int j = 0; j < m; ++j) {
      assert(a[i][j] == '*' || a[i][j] == '.');
    }
  }
  assert(getFunc() == k);
  return 1;
}

void solve() {
  if (!getAns()) {
    printf("-1\n");
    return;
  }
  for (int i = 0; i < n; ++i) {
    printf("%s\n", a[i].c_str());
  }
}

int main() {
  srand(rdtsc());
  precalc();
#ifdef DEBUG
  int T = 20;
  for (n = 3; n < T; ++n) {
    for (m = 3; m < T; ++m) {
      for (k = 0; k <= (n - 1) * (m - 1) * 4 + 1; ++k) {
        //eprintf("%d %d %d\n", n, m, k);
        getAns();
      }
    }
  }
#endif

#ifdef LOCAL
  freopen(TASKNAME".out", "w", stdout);
  assert(freopen(TASKNAME".in", "r", stdin));
#endif

  int t;
  scanf("%d", &t);
  bool first = 1;
  while (1) {
    if (!read()) {
      break;
    }
    if (!first) {
      printf("\n");
    }
    first = 0;
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define pb push_back
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.pb(i):em.pb(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.pb(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.pb(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;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#define N 200010
#define X first
#define Y second
#define g(x,y) ((x-1)*m+y)

using namespace std;

typedef pair<int,int> parii;

int t,n,m,k,Ans,T;
int B[N];
char A[N];

inline int calc(int x,int y){
  int ret=0;
  if(x-1>0&&y+1<=m&&A[g(x-1,y)]=='*'&&A[g(x-1,y+1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x-1,y)]=='*'&&A[g(x-1,y-1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x,y-1)]=='*'&&A[g(x-1,y-1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x,y-1)]=='*'&&A[g(x-1,y)]=='*') ret++;
  return ret;
}

bool S(int x,int y,int s){
  if((++T)>10*n*m) return 0;
  if(s==k) return 1;
  if(x>n) return 0;
  if(y>m) return S(x+1,1,s);
  int now=calc(x,y);
  if(s+now<=k){
    A[g(x,y)]='*';
    if(S(x,y+1,s+now)) return 1;
  }
  A[g(x,y)]='.';
  return S(x,y+1,s);
}

int main(){
  scanf("%d",&t);
  while(t--){
    scanf("%d%d%d",&n,&m,&k); T=0;
    int c=0;
    if(n<m){ c=1; swap(n,m); }
    for(int i=1;i<=n*m;i++) A[i]='.';
    if(!S(1,1,0)) puts("-1\n");
    else{
      int E=1;
      for(int i=1;i<=n*m;i++) if(A[i]=='*') E=0;
      if(E) A[1]='*';
      if(!c)
	for(int i=1;i<=n;i++,putchar('\n'))
	  for(int j=1;j<=m;j++) putchar(A[g(i,j)]);
      else
	for(int i=1;i<=m;i++,putchar('\n'))
	  for(int j=1;j<=n;j++) putchar(A[g(j,i)]);
      putchar('\n');
    }
  }
  return 0;
}

#include <iostream>
#include <vector>
#include <cstdio>

#define rank krevedka
#define left trulala
#define rigth trulalo
#define ran rank
using namespace std;
/*
void solveA(){

    int n,m;
    cin >> n >>m;
    int tot = 0;
    for(int i = 0; i < n; i++)
    for(int j = 0; j < m; j++)
        b[tot++] = {i,j};
    sort(b, b + n * m);
    int k;
    cin >> k;
    for(int i = 0; i < k; i++)
        cin >> a[i];
    sort(a, a + k);
    bool ok = true;
    for(int i = 0; i < k; i++)
        if(a[i] < b[i].first + b[i].second){ ok = false;}

    cin >> k;
    for(int i = 0; i < k; i++)
        cin >> a[i];
    sort(a, a + k);
    for(int i = 0; i < k; i++)
        if(a[i] < b[i].first + b[i].second){ ok = false;}

}
*/

int x, y, n, m, k;

vector<char> a[200500];

void go(bool get_next = false){
    a[x][y] = '*';
    if(get_next){
        x++;
        if(x == n){ x = 0; y++;}
    }
}

bool solveC(){
    for(int i = 0; i < n; i++){
        a[i].resize(m+10,'\0');
        for(int j = 0; j < m; j++)
            a[i][j] = '.';
        a[i][0] = '*';
    }
    if(k == 0) return true;
    //if(n == 1 || m == 1) return false;
    x = 0;
    y = 1;
    while(k){
        if(y == m) {  return false; }
        int l = 4;
        if(x == 0) l = 1; else
        if(x == n - 1) l = 3;
        if(k >= l){ k -= l; go(true); continue;}
        if(l == 3){
            if(y == m - 1) return false;
            if(k == 1){x = 0; y++; go(); return true;}
            //if(k == 1 && x > 1){x = 0; y++; go(); return true;}
            //if(k == 1){x = 0; y++; go(); x++; go(); return true;}
            // k == 2
            //if(x > 1){
                y++;
                go();
                x--;
                go();
                return true;
            //}
            //y++; go();
            //x--; go();
            //y++; go();
            //if(y >= m) return false;
            //return true;
        }
        // l == 4
        if(k == 1){
            x = n - 1;
            go();
            return true;
        }
        if(k == 2) {
            if(x + 1 < n - 1){
                x++;
                go();
                return true;
            }
            if(y == m - 1) return false;
            x++;
            go();
            y++;
            go();
            x--;
            go();
            return true;
        }
        // k == 3
        if(x + 3 <= n - 1){
            x++;
            go(); // + 2
            x = n - 1;
            go(); // + 1
            return true;
        }
        if(y == m - 1) return false;

        if(x + 2 <= n - 1){
            x++;
            go(); // +2
            y++;
            go(); // +0;
            x++;
            go(); // +1
            return true;
        }
        //if(x + 1 <= n - 1){
            x++;
            go();
            y++;
            go();
            x--;
            go();
            x = 0;
            go();
            return true;
        //}
    }
    return true;

}

int main()
{
    //freopen("output.txt","w",stdout);
    int t= 1000000;
    scanf("%d",&t);
    //t
    for(int q = 0; q < t; q++){
        if(q) printf("\n");
        n = q % 100;        n += 3;
        m = (q/100) % 100;        m += 3;
        k = q/1000;
        scanf("%d%d%d",&n,&m,&k);

        if(!solveC()) puts("-1"); else{
            for(int i = 0; i < n; i++)
                puts(&a[i][0]);
        }
    }
    return 0;
}

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py != m - 1) {
				a[px][1] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			return 0;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < n - 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else if (py == 1) {
					if (m != 3)
						a[px + 1][py] = a[px + 1][py + 1] = 1 , a[px][m - 1] = 1;
					else
						a[px + 1][py] = a[px + 1][py + 1] = a[px][m] = a[px + 1][m] = 1;
				}
				else
					a[px][py + 2] = 1 , a[px + 1][py] = 1 , a[px + 1][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py == 1)
			{
				if (n == 3)
				{
					if (m == 3)
						return 0;
					a[1][m] = 0 , a[2][m] = 0;
					a[3][m - 1] = 1;
					if (m == 4) a[3][2] = 1;
					else a[3][2] = 1 , a[2][m] = 1;
					return 1;
				}
			}

			if (m - py <= 3)
				return 0;

			a[1][1] = a[1][m] = a[2][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<string>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#include<bitset>
#include<vector>
#define rep(x,a,b) for (int x=a;x<=(int)b;x++)
#define drp(x,a,b) for (int x=a;x>=(int)b;x--)
#define cross(x,a) for (int x=hd[a];~x;x=nx[x])
#define ll long long
#define inf (1<<29)
#define PII pair<int,int>
#define PDD pair<double,double>
#define mk(a,b) make_pair(a,b)
#define fs first
#define sc second
#define pb push_back
using namespace std;
inline ll rd(){
	ll x=0;int ch=getchar(),f=1;
	while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();
	if (ch=='-'){f=-1;ch=getchar();}
	while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
inline void rt(ll x){
	if (x<0) putchar('-'),x=-x;
	if (x>=10) rt(x/10),putchar(x%10+'0');
		else putchar(x+'0');
}
const int maxn=100005;
bool dsc;
char s[maxn],vis[20];
int n,m,k;
inline int id(int x,int y){return (x-1)*m+y;}
void dfs(int x,int y,int n,int m){
	vis[id(x,y)]=1;
	if (x>1&&s[id(x-1,y)]=='*'&&!vis[id(x-1,y)]) dfs(x-1,y,n,m);
	if (y>1&&s[id(x,y-1)]=='*'&&!vis[id(x,y-1)]) dfs(x,y-1,n,m);
	if (x<n&&s[id(x+1,y)]=='*'&&!vis[id(x+1,y)]) dfs(x+1,y,n,m);
	if (y<m&&s[id(x,y+1)]=='*'&&!vis[id(x,y+1)]) dfs(x,y+1,n,m);
}
void dfs(int x,int y,int n,int m,int k){
	if (x==n+1){
		if (k) return;
		rep(i,1,n*m) vis[i]=0;
		rep(i,1,n) rep(j,1,m){
			if (s[id(i,j)]=='*'){
				dfs(i,j,n,m);i=n+1;break;
			}
		}
		bool f=1;
		rep(i,1,n*m) if (s[i]=='*'&&!vis[i]){f=0;break;}
		if (f) dsc=1;return;
	}
	if (x==1){
		s[id(x,y)]='*';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
		if (dsc) return;
		s[id(x,y)]='.';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
		return;
	}
	int pls=0;
	if (y>1&&s[id(x-1,y-1)]=='*'&&s[id(x,y-1)]=='*') pls++;
	if (y>1&&s[id(x-1,y-1)]=='*'&&s[id(x-1,y)]=='*') pls++;
	if (y>1&&s[id(x-1,y)]=='*'&&s[id(x,y-1)]=='*') pls++;
	if (y<m&&s[id(x-1,y)]=='*'&&s[id(x-1,y+1)]=='*') pls++;
	if (pls<=k){
		s[id(x,y)]='*';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k-pls);
		if (dsc) return;
	}
	s[id(x,y)]='.';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
	return;
}
int main(){
	for (int T=rd();T--;){
		n=rd(),m=rd(),k=rd();
		rep(i,1,n) rep(j,1,m) s[id(i,j)]='.';
		if (k>(n-1)*(m-1)*4){printf("-1\n\n");continue;}
		if (n<5&&m<5){
			dsc=0;
			dfs(1,1,n,m,k);
			if (dsc){
				rep(i,1,n){
					rep(j,1,m) putchar(s[id(i,j)]);
					putchar('\n');
				}
			}
			else puts("-1");
			puts("");continue;
		}
		int rev=0,rem=(n-1)*m;
		if (m<5) swap(n,m),rev=1;
		if (n==3&&k==8*(m-2)){
			rep(i,1,n) rep(j,2,m) s[id(i,j)]='*';
		}
		else{
			rep(j,1,m) s[id(1,j)]='*';
			for (int i=2;i<=n&&rem>4&&k>3;i++)
				for (int j=1;j<=m&&rem>4&&k>3;j++){
					s[id(i,j)]='*';
					if (j==1) k--;else if (j==m) k-=3;else k-=4;
					rem--;
				}
			int x=n-(rem-1)/m,y=m-rem%m;
			if (x<n){
				if (k==1){
					if (y>=2) s[id(x+1,1)]='*';
					else s[id(x,m)]='*';
				}
				else if (k==2){
					if (y>=3) s[id(x+1,1)]=s[id(x+1,y)]='*';
					else if (y==2) s[id(x+1,1)]=s[id(x,m)]='*';
					else s[id(x,m)]=s[id(x+1,1)]=s[id(x+1,2)]='*';
				}
				else if (k==3){
					if (y>=4) s[id(x+1,1)]=s[id(x+1,3)]='*';
					else if (y>=2) s[id(x+1,1)]=s[id(x,m)]=s[id(x+1,m)]=s[id(x+1,m-1)]='*';
					else s[id(x+1,1)]=s[id(x+1,2)]=s[id(x,m)]=s[id(x+1,m)]=s[id(x+1,m-1)]='*';
				}
			}
			else{
				if (k==1) s[id(x,m)]='*';
				else if (k==2) s[id(x,m-2)]='*';
				else if (k==3) s[id(x,m)]=s[id(x,m-2)]='*';
				else if (k==4) s[id(x,y+1)]='*';
				else if (k==5) s[id(x,y+1)]=s[id(x,m)]='*';
				else if (k==6) s[id(x,y+1)]=s[id(x,m-1)]='*';
				else if (k==8) s[id(x,y+1)]=s[id(x,y+2)]='*';
				else if (k==9) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,m)]='*';
				else if (k==12) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,y+3)]='*';
				else if (k==15) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,y+3)]=s[id(x,y+4)]='*';
				else if (k){puts("-1\n");continue;}
			}
		}
		if (rev){
			rep(j,1,m){
				rep(i,1,n) putchar(s[id(i,j)]);
				putchar('\n');
			}
		}
		else{
			rep(i,1,n){
				rep(j,1,m) putchar(s[id(i,j)]);
				putchar('\n');
			}
		}
		puts("");
	}
}

#include <bits/stdc++.h>

using namespace std;
int main() {
	cout << endl;
	return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()

#define equal equalll
#define less lesss
const int N = -1;
const long long INF = 1e9 + 19;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int n, m, k;

void read() {
    scanf("%d%d%d", &n, &m, &k);
    //db3(n, m, k);
}
set < pair < int, int > > forCheck;

int getAll(int n, int m) {
    return 4 * (n - 1) * (m - 1);
}

bool check(int x, int y) {
    return 0 <= x && x < n && 0 <= y && y < m;
}

vector<pair<int,int>> norm(pair<int,int> p1, pair<int,int> p2, pair<int,int> p3) {
    if (p2 > p3) swap(p2, p3);
    return {p1, p2, p3};
}

void print(vector < vector < char > > board, bool flagSwap) {
    if (flagSwap == 0) {
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[i][j]);
    }
    else {
        swap(n, m);
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[j][i]);
    }
}

int calcRes(const vector<vector<char>>& board) {
    int res = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            for (int id = 0; id < 4; id++) {
                int x1 = i + dx[id];
                int y1 = j + dy[id];
                int x2 = i + dx[(id + 1) % 4];
                int y2 = j + dy[(id + 1) % 4];
                if (check(x1, y1) && check(x2, y2) && board[i][j] == '*' && board[x1][y1] == '*' && board[x2][y2] == '*') {
                    res++;
                }
            }
        }
    return res;
}

bool brute() {
    vector < pair < int, int > > data(all(forCheck));
    int sz = data.size();
    set < pair < int, int > > g;
    for (auto p: data) {
        for (int i = 0; i < 4; i++) {
            int x = p.fr + dx[i];
            int y = p.sc + dy[i];
            g.insert(mp(x, y));
        }
    }
    set < vector < pair < int, int > > > tri;

    for (auto p: g) {
        for (int i = 0; i < 4; i++) {
            int x1 = p.fr + dx[i];
            int y1 = p.sc + dy[i];
            int x2 = p.fr + dx[(i + 1) % 4];
            int y2 = p.sc + dy[(i + 1) % 4];
            if (check(p.fr, p.sc) && check(x1, y1) && check(x2, y2))
                tri.insert(norm(p, mp(x1, y1), mp(x2, y2)));
        }
    }

    for (int mask = 0; mask < (1 << sz); mask++) {
        set<pair<int,int>> blocked;
        for (int i = 0; i < sz; i++)
            if (((mask >> i) & 1) == 1) {
                blocked.insert(data[i]);
            }
        int cnt = getAll(n, m);
        for (auto tr: tri) {
            bool flag = 0;
            flag |= blocked.count(tr[0]) == 1;
            flag |= blocked.count(tr[1]) == 1;
            flag |= blocked.count(tr[2]) == 1;
            cnt -= flag;
        }
        if (cnt == k) {
            vector<vector<char>> board(n, vector<char>(m, '*'));
            for (auto p: blocked)
                board[p.fr][p.sc] = '.';
            assert(calcRes(board) == k);
            print(board, 0);
            return 1;
        }
    }
    return 0;
}

void solve() {
    forCheck.clear();
    if (n * m <= 16) {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                forCheck.insert(mp(i, j));
    }
    else {
        for (int i = 0; i < 2; i++)
            for (int j = 0; j < 2; j++) {
                forCheck.insert(mp(i, j));
                forCheck.insert(mp(n - i - 1, j));
            }
    }
    if (brute())
        return;

    bool flagSwap = 0;
    if (n > m) {
        swap(n, m);
        flagSwap = 1;
    }

    if (k > getAll(n, m)) {
        puts("-1");
        return;
    }
    int cur = 1;
    for (; getAll(cur + 1, m) <= k; cur++);

    assert(m >= 5);
    int curM = 0;
    int need = k - getAll(cur, m);
    //db(need);
    for (; ((curM + 1) - 1) * 4 + 1 <= need; curM++);

    if (curM >= 1)
        need -= (curM - 1) * 4 + 1;

    //db(need);
    vector<vector<char>> board(n, vector<char>(m, '.'));
    for (int i = 0; i < cur; i++)
        for (int j = 0; j < m; j++)
            board[i][j] = '*';
    for (int j = 0; j < curM; j++)
        board[cur][j] = '*';
    int xup = min(need, m - curM - 1);

    need -= xup;
    for (int j = m - xup; j < m; j += 2)
        board[cur][j] = '*';

    //print(board, 0);
    //db(need);

    if (need > 0 && cur + 1 < n) {
        //assert(cur + 1 < n);
        for (int j = need - 1; j >= 0; j -= 2)
            board[cur + 1][j] = '*';
        assert(need < curM);
        need = 0;
    }
    int res = calcRes(board);
    assert(res + need == k);

    if (need == 0) {
        print(board, flagSwap);
        return;
    }
    else
        puts("-1");

}

void stress() {

}

int main(){

    //printf(".*.\n***\n.*.\n\n");
    //printf("**.\n**.\n*..\n\n");
    //printf(".*.\n***\n*..\n");
    //return 0;
    if (1) {
        int k = 1;
        scanf("%d", &k);
        for (int tt = 0; tt < k; tt++) {
            //db(tt);
            read();
            solve();
            if (tt + 1 != k)
                puts("");
        }
    }
    else {
        stress();
    }

    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int xx[N],yy[N],yes[N],n,m,cnt,now,flag,x,y,X,Y,K;
vi a[N];

int calc(int x,int y){
	int res=0;
	res+=a[x-1][y-1]&a[x-1][y];
	res+=a[x-1][y-1]&a[x][y-1];
	res+=a[x-1][y]&a[x][y-1];
	res+=a[x-1][y]&a[x-1][y+1];
	return res;
}

int chk(int s){
	static int q[N];
	int l=0,r=0;
	rep(i,1,cnt){
		a[xx[i]][yy[i]]=0;
		yes[i]=0;
		if(!(s>>(i-1)&1)) continue;
		if(xx[i]==x||xx[i]==x+1&&yy[i]<=y) yes[i]=1,q[r++]=i;
	}
	while(l<r){
		int u=q[l++];
		rep(v,1,cnt)if(s>>(v-1)&1){
			if(!yes[v]&&abs(xx[u]-xx[v])+abs(yy[u]-yy[v])==1){
				yes[v]=1,q[r++]=v;
			}
		}
	}
	rep(i,1,cnt) if((s>>(i-1)&1)&&!yes[i]) return 0;
	int sum=now;
	rep(i,1,cnt) if(s>>(i-1)&1) sum+=calc(xx[i],yy[i]),a[xx[i]][yy[i]]=1;
	return sum==K;
}

void rmain(){
	read(n),read(m),read(K);
	if(n<m) swap(n,m),flag=1;
	rep(i,0,n+1) a[i].clear(),a[i].resize(m+2);
	now=0,x=n,y=m;
	int rem=n*m;
	rep(i,1,n){
		int owo=0;
		rep(j,1,m){
			int nxt=calc(i,j); rem--;
			if(now+nxt<=K&&rem>=10) now+=nxt,a[i][j]=1;
			else {x=i,y=j-1; if(y==0)y=m,x--; owo=1;break;}
		}
		if(owo) break;
	}
	cnt=0,X=x,Y=y;
	while(cnt<10){
		Y++; if(Y>m) X++,Y=1;
		if(X>n) break;
		xx[++cnt]=X,yy[cnt]=Y;
	}
	int found=0;
	for(int s=(x==0?1:0);s<(1<<cnt);s++)
		if(chk(s)){
			found=1;
			break;
		}
	if(!found){
		puts("-1");
		return;
	}
	if(flag) swap(n,m);
	rep(i,1,n){
		rep(j,1,m) printf("%c",(flag?a[j][i]:a[i][j])?'*':'.');
		puts("");
	}
}

int main(){
	int T; read(T);
	while(T--) rmain(),puts("");
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
int main() {
	cout << "hi" << endl;
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 100000;

int n, m, K;

vector<int> ret[maxn + 5];

const int walk[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool vis[5][5];

void dfs(int x, int y)
{
	vis[x][y] = 1;
	REP(i, 0, 4)
	{
		int u = x + walk[i][0], v = y + walk[i][1];
		if (u < 0 || u >= n || v < 0 || v >= m) continue;
		if (!vis[u][v]) dfs(u, v);
	}
}

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d%d%d", &n, &m, &K);
		if (n <= 4 && m <= 4)
		{
			bool find = 0;
			REP(i, 1, (1 << (n * m)))
			{
				bool g[5][5];
				REP(j, 0, n) REP(k, 0, m) g[j][k] = (i >> (j * m + k) & 1);
				int cnt = 0;
				memset(vis, 0, sizeof vis);
				REP(j, 0, n) REP(k, 0, m) if (g[j][k] && !vis[j][k]) dfs(j, k);
				if (cnt > 1) continue;
				int tot = 0;
				REP(j, 0, n - 1) REP(k, 0, m - 1)
				{
					int tmp = g[j][k] + g[j + 1][k] + g[j][k + 1] + g[j + 1][k + 1];
					if (tmp == 3) ++tot;
					else if (tmp == 4) tot += 4;
				}
				if (tot == K)
				{
					find = 1;
					REP(j, 0, n)
					{
						REP(k, 0, m)
						{
							if (g[j][k]) putchar('*');
							else putchar('.');
						}
						putchar('\n');
					}
					putchar('\n');
					break;
				}
			}
			if (!find) puts("-1\n");
			continue;
		}
		if (K > ((n - 1) * (m - 1) << 2))
		{
			puts("-1\n");
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2))
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar('*');
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		else if (!K)
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((!i && !j ? '*' : '.'));
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		bool rev = 0;
		if (n > m) swap(n, m), rev = 1;
		REP(i, 0, n) ret[i] = vector<int>(m, 0);
		bool failed = 0;
		--K;
		REP(i, 0, m) ret[0][i] = 1;
		REP(i, 0, n) ret[i][0] = 1;
		int px = 0, py = m - 1;
		REP(i, 1, n) REP(j, 1, m)
		{
			if (K < 4) break;
			px = i, py = j;
			ret[i][j] = 1;
			K -= 4;
		}
		if (K == 1)
		{
			if (px != n - 1)
			{
				if (py > 1) ret[px + 1][py] = 1;
				else ret[px][m - 1] = 1;
			}
			else if (py != m - 2) ret[n - 1][m - 1] = 1;
			else failed = 1;
		}
		else if (K == 2)
		{
			if (px != n - 1)
			{
				if (py > 2) ret[px + 1][py - 1] = 1;
				else if (py == 2) ret[px + 1][py] = 1, ret[px][m - 1] = 1;
				else ret[px + 1][m - 2] = 1;
			}
			else if (py < m - 3) ret[px][py + 2] = 1;
			else failed = 1;
		}
		else if (K == 3)
		{
			if (py != m - 1)
			{
				ret[px][py + 1] = 1;
				ret[0][0] = 0;
			}
			else if (px != n - 1) ret[px + 1][1] = 1, ret[0][0] = 0;
			else failed = 1;
		}
		if (rev) swap(n, m);
		if (failed)
		{
			puts("-1");
		}
		else
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((rev ? ret[j][i] : ret[i][j]) ? '*' : '.');
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()

#define equal equalll
#define less lesss
const int N = -1;
const long long INF = 1e9 + 19;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int n, m, k;

void read() {
    scanf("%d%d%d", &n, &m, &k);
    //db3(n, m, k);
}
set < pair < int, int > > forCheck;

int getAll(int n, int m) {
    return 4 * (n - 1) * (m - 1);
}

bool check(int x, int y) {
    return 0 <= x && x < n && 0 <= y && y < m;
}

vector<pair<int,int>> norm(pair<int,int> p1, pair<int,int> p2, pair<int,int> p3) {
    if (p2 > p3) swap(p2, p3);
    return {p1, p2, p3};
}

void print(vector < vector < char > > board, bool flagSwap) {
    if (flagSwap == 0) {
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[i][j]);
    }
    else {
        swap(n, m);
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[j][i]);
    }
}

int calcRes(const vector<vector<char>>& board) {
    int res = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            for (int id = 0; id < 4; id++) {
                int x1 = i + dx[id];
                int y1 = j + dy[id];
                int x2 = i + dx[(id + 1) % 4];
                int y2 = j + dy[(id + 1) % 4];
                if (check(x1, y1) && check(x2, y2) && board[i][j] == '*' && board[x1][y1] == '*' && board[x2][y2] == '*') {
                    res++;
                }
            }
        }
    return res;
}

bool brute() {
    vector < pair < int, int > > data(all(forCheck));
    int sz = data.size();
    set < pair < int, int > > g;
    for (auto p: data) {
        for (int i = 0; i < 4; i++) {
            int x = p.fr + dx[i];
            int y = p.sc + dy[i];
            g.insert(mp(x, y));
        }
    }
    set < vector < pair < int, int > > > tri;

    for (auto p: g) {
        for (int i = 0; i < 4; i++) {
            int x1 = p.fr + dx[i];
            int y1 = p.sc + dy[i];
            int x2 = p.fr + dx[(i + 1) % 4];
            int y2 = p.sc + dy[(i + 1) % 4];
            if (check(p.fr, p.sc) && check(x1, y1) && check(x2, y2))
                tri.insert(norm(p, mp(x1, y1), mp(x2, y2)));
        }
    }

    for (int mask = 0; mask < (1 << sz); mask++) {
        set<pair<int,int>> blocked;
        for (int i = 0; i < sz; i++)
            if (((mask >> i) & 1) == 1) {
                blocked.insert(data[i]);
            }
        int cnt = getAll(n, m);
        for (auto tr: tri) {
            bool flag = 0;
            flag |= blocked.count(tr[0]) == 1;
            flag |= blocked.count(tr[1]) == 1;
            flag |= blocked.count(tr[2]) == 1;
            cnt -= flag;
        }
        if (cnt == k) {
            vector<vector<char>> board(n, vector<char>(m, '*'));
            for (auto p: blocked)
                board[p.fr][p.sc] = '.';
            assert(calcRes(board) == k);
            print(board, 0);
            return 1;
        }
    }
    return 0;
}

void solve() {
    forCheck.clear();
    if (n * m <= 16) {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                forCheck.insert(mp(i, j));
    }
    else {
        for (int i = 0; i < 2; i++)
            for (int j = 0; j < 2; j++) {
                forCheck.insert(mp(i, j));
                forCheck.insert(mp(n - i - 1, j));
            }
    }
    if (brute())
        return;

    bool flagSwap = 0;
    if (n > m) {
        swap(n, m);
        flagSwap = 1;
    }

    if (k > getAll(n, m)) {
        puts("-1");
        return;
    }
    int cur = 1;
    for (; getAll(cur + 1, m) <= k; cur++);

    assert(m >= 5);
    int curM = 0;
    int need = k - getAll(cur, m);
    //db(need);
    for (; ((curM + 1) - 1) * 4 + 1 <= need; curM++);

    if (curM >= 1)
        need -= (curM - 1) * 4 + 1;

    //db(need);
    vector<vector<char>> board(n, vector<char>(m, '.'));
    for (int i = 0; i < cur; i++)
        for (int j = 0; j < m; j++)
            board[i][j] = '*';
    for (int j = 0; j < curM; j++)
        board[cur][j] = '*';
    int xup = min(need, m - curM - 1);

    need -= xup;
    for (int j = m - xup; j < m; j += 2)
        board[cur][j] = '*';

    //print(board, 0);
    //db(need);

    if (need > 0 && cur + 1 < n) {
        //assert(cur + 1 < n);
        for (int j = need - 1; j >= 0; j -= 2)
            board[cur + 1][j] = '*';
        assert(need < curM);
        need = 0;
    }
    int res = calcRes(board);
    assert(res + need == k);

    if (need == 0) {
        print(board, flagSwap);
        return;
    }
    else
        puts("-1");

}

void stress() {

}

int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("test.txt", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    if (1) {
        int k = 1;
        scanf("%d", &k);
        for (int tt = 0; tt < k; tt++) {
            //db(tt);
            read();
            solve();
            if (tt + 1 != k)
                puts("");
        }
    }
    else {
        stress();
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;
int main() {
	int T;
	cin >> T;
	while (T--) {
		int n,m,k;
		cin >> n >> m >> k;
		int max = 4*(n-1)*(m-1);
		int gap = max-k;
		if (k>4*(n-1)*(m-1)) {
			cout << -1 << endl;
			continue;
		}
		if (k==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << ".";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==1 or gap==2 or gap==4 or gap==5) {
			cout << -1 << endl;
			continue;
		}
		if (gap==3) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-1 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==6) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==7) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if ((i==n-2 or i==n-1) and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==8) {
			if (m>3 and n>3) {
				cout << -1 << endl;
				continue;
			}
			else {
				if (m==3)
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (i==n-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
				else
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (j==m-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
			}
			continue;
		}
		if (gap==12) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-2)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		bool a[n][m];
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				a[i][j] = false;
			}
		}
		for (int i=0; i<m-1; i++) {
			a[1][i] = true;
		}
		int maxOne = 4*((m-2)*(n-2)-1)+1+3;
		int maxTwo = maxOne + 4*((m-4)*(m>3)+(n-4)*(n>3))+(m>3)+(n>3);
		int maxThree = maxTwo + 3;
		int maxFour = maxThree + 3*(m>3);
		if (k<=maxOne) {
			int squares = (k-1)/4;
			int residue = (k-1)%4;
			int s=0;
			while (squares--) {
				a[s/(n-2)+2][m-s%(n-2)-3] = true;
				s++;
			}
			for (int i=1; i<n-1; i++) {
				if (a[i][0])
					a[i+1][m-2]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
		} else if (k<=maxTwo) {
			int residue = (k-(m>3)-(n>3)-1)%4;
			int bonusSquares = (k-maxOne+3-(m>3)-(n>3))/4;
			int ii = n-2;
			int jj = 1;
			while (bonusSquares--) {
				if (jj<m-3) {
					a[0][jj]=true;
					jj++;
				} else if (ii>2) {
					a[ii][0]=true;
					ii--;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					if (i!=n-1 or j!=0)
						a[i][j]=true;
				}
			}
		} else if (k<=maxThree) {
			a[n-1][0]=true;
			int residue = (k-maxTwo)%4;
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
		} else if (k<=maxFour) {
			a[0][m-3]=true;
			int gapFour = k-maxThree-1;
			if (gapFour>0)
				a[1][m-1]=true;
			if (gapFour>1)
				a[0][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		} else if (k<=(maxFour+3)) {
			a[0][m-3]=true;
			a[0][m-2]=true;
			int gapFive = k-maxFour-1;
			if (gapFive==1)
				a[0][m-1]=true;
			else if (gapFive==2)
				a[1][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		}
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				if (a[i][j])
					cout << "*";
				else
					cout << ".";
			}
			cout << endl;
		}
	}

	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 100000;

int n, m, K;

vector<int> ret[maxn + 5];

const int walk[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool vis[7][7];
bool g[7][7];

void dfs(int x, int y)
{
	vis[x][y] = 1;
	REP(i, 0, 4)
	{
		int u = x + walk[i][0], v = y + walk[i][1];
		if (u < 0 || u >= n || v < 0 || v >= m) continue;
		if (g[u][v] && !vis[u][v]) dfs(u, v);
	}
}

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d%d%d", &n, &m, &K);
		if (n * m <= 20)
		{
			bool find = 0;
			REP(i, 1, (1 << (n * m)))
			{
				REP(j, 0, n) REP(k, 0, m) g[j][k] = (i >> (j * m + k) & 1);
				int cnt = 0;
				memset(vis, 0, sizeof vis);
				REP(j, 0, n) REP(k, 0, m) if (g[j][k] && !vis[j][k]) dfs(j, k), ++cnt;
				if (cnt > 1) continue;
				int tot = 0;
				REP(j, 0, n - 1) REP(k, 0, m - 1)
				{
					int tmp = g[j][k] + g[j + 1][k] + g[j][k + 1] + g[j + 1][k + 1];
					if (tmp == 3) ++tot;
					else if (tmp == 4) tot += 4;
				}
				if (tot == K)
				{
					find = 1;
					REP(j, 0, n)
					{
						REP(k, 0, m)
						{
							if (g[j][k]) putchar('*');
							else putchar('.');
						}
						putchar('\n');
					}
					putchar('\n');
					break;
				}
			}
			if (!find) puts("-1\n");
			continue;
		}
		if (K > ((n - 1) * (m - 1) << 2))
		{
			puts("-1\n");
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2))
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar('*');
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2) - 8)
		{
			if (n == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!j ? '.' : '*');
					putchar('\n');
				}
			}
			else if (m == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!i ? '.' : '*');
					putchar('\n');
				}
			}
			else puts("NO");
			putchar('\n');
			continue;
		}
		else if (!K)
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((!i && !j ? '*' : '.'));
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		bool rev = 0;
		if (n > m) swap(n, m), rev = 1;
		REP(i, 0, n) ret[i] = vector<int>(m, 0);
		bool failed = 0;
		--K;
		REP(i, 0, m) ret[0][i] = 1;
		int px = 0, py = m - 1;
		REP(i, 1, n) REP(j, 1, m)
		{
			if (K < 4) break;
			px = i, py = j;
			ret[i][j] = 1;
			K -= 4;
		}
		if (py == m - 1) ++px, py = 0;
		REP(i, 0, px + 1) ret[i][0] = 1;
		if (K == 1)
		{
			if (px != n - 1)
			{
				if (py >= 1) ret[px + 1][0] = 1;
				else ret[px][m - 1] = 1;
			}
			else if (py < m - 2) ret[n - 1][m - 1] = 1;
			else failed = 1;
		}
		else if (K == 2)
		{
			if (px != n - 1)
			{
				if (py >= 2) ret[px + 1][1] = 1;
				else ret[px][m - 2] = 1;
			}
			else if (py < m - 3) ret[px][m - 2] = 1;
			else failed = 1;
		}
		else if (K == 3)
		{
			if (px != n - 1)
			{
				if (py >= 3) ret[px + 1][0] = ret[px + 1][py - 1] = 1;
				else if (py == 2) ret[px + 1][1] = ret[px][m - 1] = 1;
				else if (py == 1) ret[px + 1][0] = ret[px][m - 2] = 1;
				else ret[px][m - 3] = ret[px][m - 1] = 1;
			}
			else if (py < m - 4) ret[px][m - 3] = ret[px][m - 1] = 1;
			else failed = 1;
		}
		if (rev) swap(n, m);
		if (failed)
		{
			puts("-1");
		}
		else
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((rev ? ret[j][i] : ret[i][j]) ? '*' : '.');
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=100005;
int w[N],q[N],vis[N];
int n,m,k,fl,qq[N];
bool connect(){
	int h=0,t=1,cnt=0;
	For(i,1,n*m) vis[i]=0;
	For(i,1,n*m) if (w[i]) q[1]=i,++cnt;
	vis[q[1]]=1;
	while (h!=t){
		int x=q[++h];
		if (x+m<=n&&w[x+m]&&!vis[x+m])
			vis[x+m]=1,q[++t]=x+m;
		if (x-m>=1&&w[x-m]&&!vis[x-m])
			vis[x-m]=1,q[++t]=x-m;
		if (x%m!=0&&w[x+1]&&!vis[x+1])
			vis[x+1]=1,q[++t]=x+1;
		if (x%m!=1&&w[x-1]&&!vis[x-1])
			vis[x-1]=1,q[++t]=x-1;
	}
	return cnt==t;
}
int count(){
	int ans=0;
	For(i,1,(n-1)*m) if (i%m){
		ans+=w[i]&w[i+1]&w[i+m];
		ans+=w[i]&w[i+1]&w[i+1+m];
		ans+=w[i]&w[i+m]&w[i+1+m];
		ans+=w[i+1]&w[i+m]&w[i+1+m];
	}
	return ans;
}
int check(int p){
	For(i,1,n*m) w[i]=(i<=p);
	return count();
}
bool work(){
	int c=4*(n-1)*(m-1);
	if (k>c||k==c-1||k==c-2||k==c-4||k==c-5) return 0;
	if (k==c-8&&n!=3&&m!=3) return 0;
	int l=0,r=n*m,ans=0;
	while (l<=r){
		int mid=(l+r)/2;
		if (check(mid)<=k)
			ans=mid,l=mid+1;
		else r=mid-1;
	}
	check(ans);
	int cur=count(),top=0;
	if (cur==k) return 1;
	For(i,1,n*m)
		if ((i-1)/m==0||abs((i-1)/m-(ans-1)/m)<=1)
			qq[++top]=i;
	for (;cur^k;){
		int at,x;
		if (cur<k){
			for (;;){
				at=rand()%top+1;
				if (!w[qq[at]]) break;
			}
			x=qq[at]; w[x]=1;
			if (!connect()){
				w[x]=0; continue;
			}
			cur=count();
		}
		else{
			for (;;){
				at=rand()%top+1;
				if (w[qq[at]]) break;
			}
			x=qq[at]; w[x]=0;
			if (!connect()){
				w[x]=1; continue;
			}
			cur=count();
		}
	}
	return 1;
}
void solve(){
	scanf("%d%d%d",&n,&m,&k);
	int fl=(n<m);
	if (fl) swap(n,m);
	if (!work()) puts("-1");
	else if (fl){
		For(i,1,n){
			For(j,1,m) putchar(w[(i-1)*m+j]?'*':'.');
			puts("");
		}
	}
	else{
		For(i,1,m){
			For(j,1,n) putchar(w[(j-1)*m+i]?'*':'.');
			puts("");
		}
	}
	puts("");
}
int main(){
	srand(19*6*817);
	int T;
	scanf("%d",&T);
	while (T--) solve();
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int X1[4]={0,0,0,0};
int Y1[4]={-1,-1,1,1};
int X2[4]={-1,1,-1,1};
int Y2[4]={0,0,0,0};
int X[4]={0,0,1,-1};
int Y[4]={1,-1,0,0};
int i,j,k,n,m,x,y,T,Cnt,xx,yy;
bool f,F,f2;
map<int,bool>b[200010],a[200010];
inline int Calc(int x,int y){
	int Ans=0;
	for(int p=0;p<4;p++){
		int xx=x+X1[p],yy=y+Y1[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		xx=x+X2[p];yy=y+Y2[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		Ans++;
	}
	return Ans;
}
inline void Dfs(int x,int y,int Sum){
	if(++Cnt>(n*m*10)||f||Sum>k)return;
	if(Sum==k){
		f=1;
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)a[i][j]=b[i][j];
		return;
	}
	if(y==m+1)x++,y=1;
	if(x==n+1)return;
	bool f3=0;
	for(int p=0;p<4;p++){
		xx=x+X[p];yy=y+Y[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		f3=1;break;
	}
	if(!f2||f3){
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum-=Calc(xx,yy);
		}
		int s=Sum;
		b[x][y]=1;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum+=Calc(xx,yy);
		}
		Dfs(x,y+1,Sum+Calc(x,y));
		f2=1;
		b[x][y]=0;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			s+=Calc(xx,yy);
		}
		Dfs(x,y+1,s);
	}else{
		b[x][y]=0;
		Dfs(x,y+1,Sum);
	}
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&k);
		F=0;
		if(n<m)swap(n,m),F=1;
		f=Cnt=f2=0;Dfs(1,1,0);
		if(f){
			if(F)
			for(i=1;i<=m;i++){
				for(j=1;j<=n;j++)
				if(a[j][i])putchar('*');else putchar('.');
				putchar('\n');
			}else
			for(i=1;i<=n;i++){
				for(j=1;j<=m;j++)
				if(a[i][j])putchar('*');else putchar('.');
				putchar('\n');
			}
		}else puts("-1");
		putchar('\n');
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=1;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    bool iv=0;
    if(n<5&&m<5)
    {
        if(!hasans[n][m][K])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(n==3&&m>=5&&K==2*(m-1)+8)
    {
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar(i+j==2?'*':'.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(n>m)swap(n,m),iv=1;
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else if(fy==2)flag[fx+1][1]=1,flag[fx][m-1]=1;
                    else flag[fx][3]=1,flag[fx][m]=1;
                }
                goto output;
            }
            else if(K<4||(i==n&&fy==m-5))
            {
                for(int k=0;k<32;k++)
                {
                    for(int l=0;l<5;l++)flag[i][j+l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    if(!iv)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    else
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            putchar(flag[j][i]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

char DB[5][5][37][4][4];

char *A[100005];
bool chk[10][10];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void dfs(int y, int x) {
	chk[y][x] = true;
	for(int dr = 0; dr < 4; dr++) {
		int ny = y+dy[dr], nx = x+dx[dr];
		if('*' != A[ny][nx] || chk[ny][nx]) continue;
		dfs(ny, nx);
	}
}
bool isConnected(int H, int W) {
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	bool flag = false;
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++) {
			if('*' == A[i][j]) {
				flag = true;
				dfs(i, j);
				break;
			}
		}
		if(flag) break;
	}

	if(!flag) return false;

	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('*' == A[i][j] && !chk[i][j]) return false;
	return true;
}

void printAnswer(int H, int W) {
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar(A[i][j]);
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);
			if(!isConnected(h, w)) continue;

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						bool iscon = true, niscon = true;

						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;

							if('*' != A[i-1][j+k] && '*' == A[i][j+k-1]) iscon = false;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
						}

						if(sum+nsum == N && iscon && niscon) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0; niscon = true;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;
							if('*' != A[i-1][W] && '*' != A[i][W-1]) iscon = false;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
								if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
							}

							if(sum+nsum == N && iscon && niscon) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#define N 200010
#define X first
#define Y second
#define g(x,y) ((x-1)*m+y)

using namespace std;

typedef pair<int,int> parii;

int t,n,m,k,Ans,T;
int B[N];
char A[N];

inline int calc(int x,int y){
  int ret=0;
  if(x-1>0&&y+1<=m&&A[g(x-1,y)]=='*'&&A[g(x-1,y+1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x-1,y)]=='*'&&A[g(x-1,y-1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x,y-1)]=='*'&&A[g(x-1,y-1)]=='*') ret++;
  if(x-1>0&&y-1>0&&A[g(x,y-1)]=='*'&&A[g(x-1,y)]=='*') ret++;
  return ret;
}

bool S(int x,int y,int s){
  if((++T)>10*n*m) return 0;
  if(s==k) return 1;
  if(x>n) return 0;
  if(y>m) return S(x+1,1,s);
  int now=calc(x,y);
  if(s+now<=k){
    A[g(x,y)]='*';
    if(S(x,y+1,s+now)) return 1;
  }
  A[g(x,y)]='.';
  return S(x,y+1,s);
}

int main(){
  scanf("%d",&t);
  while(t--){
    scanf("%d%d%d",&n,&m,&k); T=0;
    int c=0;
    if(n<m){ c=1; swap(n,m); }
    for(int i=1;i<=n*m;i++) A[i]='.';
    if(!S(1,1,0)) puts("-1\n");
    else{
      if(!c)
	for(int i=1;i<=n;i++,putchar('\n'))
	  for(int j=1;j<=m;j++) putchar(A[g(i,j)]);
      else
	for(int i=1;i<=m;i++,putchar('\n'))
	  for(int j=1;j<=n;j++) putchar(A[g(j,i)]);
      putchar('\n');
    }
  }
  return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int xx[N],yy[N],yes[N],n,m,cnt,now,flag,x,y,X,Y,K,L=10;
vi a[N];

int calc(int x,int y){
	int res=0;
	res+=a[x-1][y-1]&a[x-1][y];
	res+=a[x-1][y-1]&a[x][y-1];
	res+=a[x-1][y]&a[x][y-1];
	res+=a[x-1][y]&a[x-1][y+1];
	return res;
}

int chk(int s){
	static int q[N];
	int l=0,r=0;
	rep(i,1,cnt){
		a[xx[i]][yy[i]]=0;
		yes[i]=0;
		if(!(s>>(i-1)&1)) continue;
		if(xx[i]==x||xx[i]==x+1&&yy[i]<=y) yes[i]=1,q[r++]=i;
	}
	while(l<r){
		int u=q[l++];
		rep(v,1,cnt)if(s>>(v-1)&1){
			if(!yes[v]&&abs(xx[u]-xx[v])+abs(yy[u]-yy[v])==1){
				yes[v]=1,q[r++]=v;
			}
		}
	}
	rep(i,1,cnt) if((s>>(i-1)&1)&&!yes[i]) return 0;
	int sum=now;
	rep(i,1,cnt) if(s>>(i-1)&1) sum+=calc(xx[i],yy[i]),a[xx[i]][yy[i]]=1;
	return sum==K;
}

void rmain(){
	read(n),read(m),read(K);
	if(n<m) swap(n,m),flag=1; else flag=0;
	rep(i,0,n+1) a[i].clear(),a[i].resize(m+2);
	now=0,x=n,y=m;
	int rem=n*m;
	rep(i,1,n){
		int owo=0;
		rep(j,1,m){
			int nxt=calc(i,j); rem--;
			if(now+nxt<=K&&rem>=L) now+=nxt,a[i][j]=1;
			else {x=i,y=j-1; if(y==0)y=m,x--; owo=1;break;}
		}
		if(owo) break;
	}
	cnt=0,X=x,Y=y;
	int Flag=(x<n);
	while(cnt+flag<L){
		Y++; if(Y>m) X++,Y=1;
		if(X>n) break;
		xx[++cnt]=X,yy[cnt]=Y;
		if(X==x+1&&Y==y) Flag=0;
	}
	if(Flag) xx[++cnt]=x+1,yy[cnt]=y;
	int found=0;
	for(int s=(x==0?1:0);s<(1<<cnt);s++)
		if(chk(s)){
			found=1;
			break;
		}
	if(!found){
		puts("-1");
		return;
	}
	if(flag) swap(n,m);
	rep(i,1,n){
		rep(j,1,m) printf("%c",(flag?a[j][i]:a[i][j])?'*':'.');
		puts("");
	}
}

int main(){
	int T; read(T);
	while(T--) rmain(),puts("");
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 100000;

int n, m, K;

vector<int> ret[maxn + 5];

const int walk[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool vis[5][5];

void dfs(int x, int y)
{
	vis[x][y] = 1;
	REP(i, 0, 4)
	{
		int u = x + walk[i][0], v = y + walk[i][1];
		if (u < 0 || u >= n || v < 0 || v >= m) continue;
		if (!vis[u][v]) dfs(u, v);
	}
}

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d%d%d", &n, &m, &K);
		if (n * m <= 20)
		{
			bool find = 0;
			REP(i, 1, (1 << (n * m)))
			{
				bool g[5][5];
				REP(j, 0, n) REP(k, 0, m) g[j][k] = (i >> (j * m + k) & 1);
				int cnt = 0;
				memset(vis, 0, sizeof vis);
				REP(j, 0, n) REP(k, 0, m) if (g[j][k] && !vis[j][k]) dfs(j, k);
				if (cnt > 1) continue;
				int tot = 0;
				REP(j, 0, n - 1) REP(k, 0, m - 1)
				{
					int tmp = g[j][k] + g[j + 1][k] + g[j][k + 1] + g[j + 1][k + 1];
					if (tmp == 3) ++tot;
					else if (tmp == 4) tot += 4;
				}
				if (tot == K)
				{
					find = 1;
					REP(j, 0, n)
					{
						REP(k, 0, m)
						{
							if (g[j][k]) putchar('*');
							else putchar('.');
						}
						putchar('\n');
					}
					putchar('\n');
					break;
				}
			}
			if (!find) puts("-1\n");
			continue;
		}
		if (K > ((n - 1) * (m - 1) << 2))
		{
			puts("-1\n");
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2))
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar('*');
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2) - 8)
		{
			if (n == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!j ? '.' : '*');
					putchar('\n');
				}
			}
			else if (m == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!i ? '.' : '*');
					putchar('\n');
				}
			}
			else puts("NO");
			putchar('\n');
			continue;
		}
		else if (!K)
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((!i && !j ? '*' : '.'));
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		bool rev = 0;
		if (n > m) swap(n, m), rev = 1;
		REP(i, 0, n) ret[i] = vector<int>(m, 0);
		bool failed = 0;
		--K;
		REP(i, 0, m) ret[0][i] = 1;
		int px = 0, py = m - 1;
		REP(i, 1, n) REP(j, 1, m)
		{
			if (K < 4) break;
			px = i, py = j;
			ret[i][j] = 1;
			K -= 4;
		}
		if (py == m - 1) ++px, py = 0;
		REP(i, 0, px + 1) ret[i][0] = 1;
		if (K == 1)
		{
			if (px != n - 1)
			{
				if (py >= 1) ret[px + 1][0] = 1;
				else ret[px][m - 1] = 1;
			}
			else if (py < m - 2) ret[n - 1][m - 1] = 1;
			else failed = 1;
		}
		else if (K == 2)
		{
			if (px != n - 1)
			{
				if (py >= 2) ret[px + 1][1] = 1;
				else ret[px][m - 2] = 1;
			}
			else if (py < m - 3) ret[px][m - 2] = 1;
			else failed = 1;
		}
		else if (K == 3)
		{
			if (px != n - 1)
			{
				if (py >= 3) ret[px + 1][0] = ret[px + 1][py - 1] = 1;
				else if (py == 2) ret[px + 1][1] = ret[px][m - 1] = 1;
				else if (py == 1) ret[px + 1][0] = ret[px][m - 2] = 1;
				else ret[px][m - 3] = ret[px][m - 1] = 1;
			}
			else if (py < m - 4) ret[px][m - 3] = ret[px][m - 1] = 1;
			else failed = 1;
		}
		if (rev) swap(n, m);
		if (failed)
		{
			puts("-1");
		}
		else
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((rev ? ret[j][i] : ret[i][j]) ? '*' : '.');
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }

char DB[5][5][37][4][4];

char *A[100005];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void printAnswer(int H, int W) {
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar(A[i][j]);
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
						}

						if(sum+nsum == N) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							}

							if(sum+nsum == N) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=1;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=1;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    bool iv=0;
    if(n<5&&m<5)
    {
        if(!hasans[n][m][K])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(n==3&&m>=5&&K==8*(m-2))
    {
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar(i+j==2?'*':'.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(n>m)swap(n,m),iv=1;
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else if(fy==2)flag[fx+1][1]=1,flag[fx][m-1]=1;
                    else flag[fx][3]=1,flag[fx][m]=1;
                }
                goto output;
            }
            else if(K<4||(i==n&&fy==m-5))
            {
                for(int k=0;k<32;k++)
                {
                    for(int l=0;l<5;l++)flag[i][m-l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    if(!iv)
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    else
    for(int i=1;i<=m;i++)
    {
        for(int j=1;j<=n;j++)
        {
            putchar(flag[j][i]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
int main() {
	int T;
	cin >> T;
	while (T--) {
		int n,m,k;
		cin >> n >> m >> k;
		int max = 4*(n-1)*(m-1);
		int gap = max-k;
		if (k>4*(n-1)*(m-1)) {
			cout << -1 << endl;
			continue;
		}
		if (k==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << ".";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==1 or gap==2 or gap==4 or gap==5) {
			cout << -1 << endl;
			continue;
		}
		if (gap==3) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-1 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==6) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==7) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if ((i==n-2 or i==n-1) and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==8) {
			if (m>3 and n>3) {
				cout << -1 << endl;
				continue;
			}
			else {
				if (m==3)
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (i==n-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
				else
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (j==m-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
			}
			continue;
		}
		if (gap==12) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-2)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		bool a[n][m];
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				a[i][j] = false;
			}
		}
		for (int i=0; i<m-1; i++) {
			a[1][i] = true;
		}
		int maxOne = 4*((m-2)*(n-2)-1)+1+3;
		int maxTwo = maxOne + 4*(m-4+n-4)+(m>3)+(n>3);
		int maxThree = maxTwo + 3;
		int maxFour = maxThree + 3*(m>3);
		if (k<=maxOne) {
			int squares = (k-1)/4;
			int residue = (k-1)%4;
			int s=0;
			while (squares--) {
				a[s/(n-2)+2][m-s%(n-2)-3] = true;
				s++;
			}
			for (int i=1; i<n-1; i++) {
				if (a[i][0])
					a[i+1][m-2]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
		} else if (k<=maxTwo) {
			int residue = (k-(m>3)-(n>3)-1)%4;
			int bonusSquares = (k-maxOne+3-(m>3)-(n>3))/4;
			int ii = n-2;
			int jj = 1;
			while (bonusSquares--) {
				if (jj<m-3) {
					a[0][jj]=true;
					jj++;
				} else if (ii>2) {
					a[ii][0]=true;
					ii--;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					if (i!=n-1 or j!=0)
						a[i][j]=true;
				}
			}
		} else if (k<=maxThree) {
			a[n-1][0]=true;
			int residue = (k-maxTwo)%4;
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
		} else if (k<=maxFour) {
			a[0][m-3]=true;
			int gapFour = k-maxThree-1;
			if (gapFour>0)
				a[1][m-1]=true;
			if (gapFour>1)
				a[0][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		} else if (k<=(maxFour+3)) {
			a[0][m-3]=true;
			a[0][m-2]=true;
			int gapFive = k-maxFour-1;
			if (gapFive==1)
				a[0][m-1]=true;
			else if (gapFive==2)
				a[1][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		}
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				if (a[i][j])
					cout << "*";
				else
					cout << ".";
			}
			cout << endl;
		}
	}

	return 0;
}

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py != m - 1) {
				a[px][1] = 0;
				a[px][py + 1] = 1;
			}

			return 0;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < n - 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else if (py == 1) {
					if (m != 3)
						a[px + 1][py] = a[px + 1][py + 1] = 1 , a[px][m - 1] = 1;
					else
						a[px + 1][py] = a[px + 1][py + 1] = a[px][m] = a[px + 1][m] = 1;
				}
				else
					a[px][py + 2] = 1 , a[px + 1][py] = 1 , a[px + 1][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py == 1)
			{
				if (n == 3)
				{
					if (m == 3)
						return 0;
					a[1][m] = 0 , a[2][m] = 0;
					a[3][m - 1] = 1;
					if (m == 4) a[3][2] = 1;
					else a[3][2] = 1 , a[2][m] = 1;
					return 1;
				}
			}

			if (m - py <= 3)
				return 0;

			a[1][1] = a[1][m] = a[2][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

#include<bits/stdc++.h>

using namespace std;
void print(vector <vector <char> > a, bool flag)
{
	if(flag)
	{
		for(int j = 0; j < a[0].size(); j++)
		{
			for(int i = 0; i < a.size(); i++)
			{
				cout << a[i][j] << "";
			}
			cout << "\n";
		}
	}
	else
	{
		for(int i = 0; i < a.size(); i++)
		{
			for(int j = 0; j < a[i].size(); j++)
			{
				cout << a[i][j] << "";
			}
			cout << "\n";
		}
	}
	cout << "\n";
}
signed main(){
//	ios_base::sync_with_stdio(false);
//	cin.tie(NULL);
//	cout.tie(NULL);
	int t;
	cin >> t;
	while(t--)
	{
		int n, m, k;
		cin >> n >> m >> k;
		bool flag = 0;
		if(n > m)
		{
			swap(n, m);
			flag = 1;
		}
		bool found = 0;
		vector <vector <int> > a(n + 2, vector <int> (m + 2));
		for(int s = 1; s <= m; s++)
		{
			for(int i = 0; i <= n + 1; i++)
			{
				for(int j = 0; j <= m + 1; j++)
				{
					a[i][j] = 0;
				}
			}
			for(int i = 1; i <= s; i++)
			{
				a[1][i] = 1;
			}
			int cnt = 0;
			for(int i = 2; i <= n; i++)
			{
				for(int j = 1; j <= m; j++)
				{
					int add = a[i - 1][j] * (a[i - 1][j - 1] + a[i - 1][j + 1]) + a[i - 1][j] * a[i][j - 1] + a[i][j - 1] * a[i - 1][j - 1];
					if(cnt + add <= k && (a[i - 1][j] + a[i][j - 1]) > 0)
					{
						a[i][j] = 1;
						cnt += add;
					}
				}
			}
			if(cnt == k)
			{
				found = 1;
				break;
			}
		}
		if(!found)
		{
			cout << -1 << "\n\n";
		}
		else if(flag)
		{
			for(int j = 1; j <= m; j++)
			{
				for(int i = 1; i <= n; j++)
				{
					if(a[i][j])
					{
						cout << "*";
					}
					else
					{
						cout << ".";
					}
				}
				cout << "\n";
			}
			cout << "\n";
		}
		else
		{
			for(int i = 1; i <= n; i++)
			{
				for(int j = 1; j <= m; j++)
				{
					if(a[i][j])
					{
						cout << "*";
					}
					else
					{
						cout << ".";
					}
				}
				cout << "\n";
			}
			cout << '\n';
		}
	}
	return 0;
}

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py != m - 1)
			{
				a[px][1] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			return 0;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < m - 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else if (py == 1) {
					if (m != 3)
						a[px + 1][py] = a[px + 1][py + 1] = 1 , a[px][m - 1] = 1;
					else
						a[px + 1][py] = a[px + 1][py + 1] = a[px][m] = a[px + 1][m] = 1;
				}
				else
					a[px][m] = 1 , a[px + 1][py] = a[px + 1][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py == 1)
			{
				if (n == 3)
				{
					if (m == 3)
						return 0;
					a[1][m] = 0 , a[2][m] = 0;
					a[3][m - 1] = 1;
					if (m == 4) a[3][2] = 1;
					else a[3][2] = 1 , a[2][m] = 1;
					return 1;
				}
			}

			if (m - py <= 3)
				return 0;

			a[1][1] = a[1][m] = a[2][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cctype>
#include<ctime>
#include<cstdlib>
#include<string>
#include<queue>
#include<cmath>
#include<set>
#include<map>
#include<bitset>
#include<vector>
#define rep(x,a,b) for (int x=a;x<=(int)b;x++)
#define drp(x,a,b) for (int x=a;x>=(int)b;x--)
#define cross(x,a) for (int x=hd[a];~x;x=nx[x])
#define ll long long
#define inf (1<<29)
#define PII pair<int,int>
#define PDD pair<double,double>
#define mk(a,b) make_pair(a,b)
#define fs first
#define sc second
#define pb push_back
using namespace std;
inline ll rd(){
	ll x=0;int ch=getchar(),f=1;
	while (!isdigit(ch)&&(ch!='-')&&(ch!=EOF)) ch=getchar();
	if (ch=='-'){f=-1;ch=getchar();}
	while (isdigit(ch)){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}
inline void rt(ll x){
	if (x<0) putchar('-'),x=-x;
	if (x>=10) rt(x/10),putchar(x%10+'0');
		else putchar(x+'0');
}
const int maxn=100005;
bool dsc;
char s[maxn];
int n,m,k;
inline int id(int x,int y){return (x-1)*m+y;}
void dfs(int x,int y,int n,int m,int k){
	if (x==n+1){
		if (!k) dsc=1;
		return;
	}
	if (x==1){
		s[id(x,y)]='*';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
		if (dsc) return;
		s[id(x,y)]='.';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
		return;
	}
	int pls=0;
	if (y>1&&s[id(x-1,y-1)]=='*'&&s[id(x,y-1)]=='*') pls++;
	if (y>1&&s[id(x-1,y-1)]=='*'&&s[id(x-1,y)]=='*') pls++;
	if (y>1&&s[id(x-1,y)]=='*'&&s[id(x,y-1)]=='*') pls++;
	if (y<m&&s[id(x-1,y)]=='*'&&s[id(x-1,y+1)]=='*') pls++;
	if (pls<=k){
		s[id(x,y)]='*';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k-pls);
		if (dsc) return;
	}
	s[id(x,y)]='.';dfs(y==m?x+1:x,y==m?1:y+1,n,m,k);
	return;
}
int main(){
	for (int T=rd();T--;){
		n=rd(),m=rd(),k=rd();
		rep(i,1,n) rep(j,1,m) s[id(i,j)]='.';
		if (k>(n-1)*(m-1)*4){printf("-1\n\n");continue;}
		if (n<5&&m<5){
			dsc=0;
			dfs(1,1,n,m,k);
			if (dsc){
				rep(i,1,n){
					rep(j,1,m) putchar(s[id(i,j)]);
					putchar('\n');
				}
			}
			else puts("-1");
			puts("");continue;
		}
		int rev=0,rem=(n-1)*m;
		if (m<5) swap(n,m),rev=1;
		if (n==3&&k==8*(m-2)){
			rep(i,1,n) rep(j,2,m) s[id(i,j)]='*';
		}
		else{
			rep(j,1,m) s[id(1,j)]='*';
			for (int i=2;i<=n&&rem>4&&k>3;i++)
				for (int j=1;j<=m&&rem>4&&k>3;j++){
					s[id(i,j)]='*';
					if (j==1) k--;else if (j==m) k-=3;else k-=4;
					rem--;
				}
			int x=n-(rem-1)/m,y=m-rem%m;
			if (x<n){
				if (k==1){
					if (y>=2) s[id(x+1,1)]='*';
					else s[id(x,m)]='*';
				}
				else if (k==2){
					if (y>=3) s[id(x+1,1)]=s[id(x+1,y)]='*';
					else if (y==2) s[id(x+1,1)]=s[id(x,m)]='*';
					else s[id(x,m)]=s[id(x+1,1)]=s[id(x+1,2)]='*';
				}
				else if (k==3){
					if (y>=4) s[id(x+1,1)]=s[id(x+1,3)]='*';
					else if (y>=2) s[id(x+1,1)]=s[id(x,m)]=s[id(x+1,m)]=s[id(x+1,m-1)]='*';
					else s[id(x+1,1)]=s[id(x+1,2)]=s[id(x,m)]=s[id(x+1,m)]=s[id(x+1,m-1)]='*';
				}
			}
			else{
				if (k==1) s[id(x,m)]='*';
				else if (k==2) s[id(x,m-2)]='*';
				else if (k==3) s[id(x,m)]=s[id(x,m-2)]='*';
				else if (k==4) s[id(x,y+1)]='*';
				else if (k==5) s[id(x,y+1)]=s[id(x,m)]='*';
				else if (k==6) s[id(x,y+1)]=s[id(x,m-1)]='*';
				else if (k==8) s[id(x,y+1)]=s[id(x,y+2)]='*';
				else if (k==9) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,m)]='*';
				else if (k==12) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,y+3)]='*';
				else if (k==15) s[id(x,y+1)]=s[id(x,y+2)]=s[id(x,y+3)]=s[id(x,y+4)]='*';
				else if (k){puts("-1\n");continue;}
			}
		}
		if (rev){
			rep(j,1,m){
				rep(i,1,n) putchar(s[id(i,j)]);
				putchar('\n');
			}
		}
		else{
			rep(i,1,n){
				rep(j,1,m) putchar(s[id(i,j)]);
				putchar('\n');
			}
		}
		puts("");
	}
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
bool __barr[550055], *__pbarr=__barr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }
inline bool* newbool(const unsigned int SZ) {
	__pbarr += SZ;
	return __pbarr - SZ;
}
inline void initbool() { __pbarr=__barr; }
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

char DB[5][5][37][4][4];

char *A[100005];
bool *chk[100005];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void dfs(int y, int x) {
	chk[y][x] = true;
	for(int dr = 0; dr < 4; dr++) {
		int ny = y+dy[dr], nx = x+dx[dr];
		if('*' != A[ny][nx] || chk[ny][nx]) continue;
		dfs(ny, nx);
	}
}
bool isConnected(int H, int W) {
	initbool();
	for(int i = 0; i <= H+1; i++)
		chk[i] = newbool(W+2);
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	bool flag = false;
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++) {
			if('*' == A[i][j]) {
				flag = true;
				dfs(i, j);
				break;
			}
		}
		if(flag) break;
	}

	if(!flag) return false;

	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('*' == A[i][j] && !chk[i][j]) return false;
	return true;
}

void printAnswer(int H, int W) {
	initbool();
	for(int i = 0; i <= H+1; i++)
		chk[i] = newbool(W+2);
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	dfs(1, 1);

	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar('*' == A[i][j] && chk[i][j] ? '*' : '.');
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);
			if(!isConnected(h, w)) continue;

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		if((H-1) * (W-2) * 4 == N) {
			for(int i = 1; i <= H; i++) {
				for(int j = 1; j < W; j++)
					putchar('*');
				puts(".");
			}
			continue;
		}

		if((H-2) * (W-1) * 4 == N) {
			for(int i = 1; i < H; i++) {
				for(int j = 1; j <= W; j++)
					putchar('*');
				puts("");
			}
			for(int j = 1; j <= W; j++)
				putchar('.');
			puts("");
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						bool iscon = true, niscon = true;

						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;
							if('*' != A[i-1][j+k] && '*' != A[i][j+k-1]) iscon = false;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
						}

						if(sum+nsum == N && iscon && niscon) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0; niscon = true;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;
							if('*' != A[i-1][W] && '*' != A[i][W-1]) iscon = false;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
								if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
							}

							if(sum+nsum == N && iscon && niscon) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#include <iostream>
#include <vector>

using namespace std;

int n,m,k;
vector<vector<int> > v;
bool transponer;

void escribe()
{
  if (transponer) {
    vector<vector<int> > nextv(m+2,vector<int> (n+2,0));
    for (int i=1;i<=n;i++)
      for (int j=1;j<=m;j++)
	nextv[j][i]=v[i][j];
    swap(n,m);
    v=nextv;
  }
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++)
      if (v[i][j]) cout<<"*";
      else cout<<".";
    cout<<endl;
  }
}

int valor(int i,int j)
{
  if (i==1) return 0;
  if (j==1) return 1;
  if (j==m) return 3;
  return 4;
}

void genera()
{
  int act=0;
  for (int i=1;i<=n;i++) {
    for (int j=1;j<=m;j++) {
      if (act+valor(i,j)>k) {
	int resta=k-act;
	if (resta==1) {
	  if (m>j) v[i][m]=1;
	  else v[i+1][1]=1;
	} else if (resta==2) {
	  if (m-j+1>=3) v[i][m-1]=1;
	  else if (m-j+1==2) v[i][m]=v[i+1][m]=v[i+1][m-1]=1;
	  else v[i+1][2]=1;
	} else {
	  // resta==3.
	  if (m-j+1>=4) v[i][m]=v[i][m-2]=1;
	  else if (j==2) v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=v[i+1][2]=1;
	  else v[i][m]=v[i+1][m]=v[i+1][m-1]=v[i+1][1]=1;
	}
	escribe();
	return;
      }
      v[i][j]=1;
      act+=valor(i,j);
      if (act==k) {
	escribe();
	return;
      }
    }
  }
}

int main()
{
  ios::sync_with_stdio(false);
  int casos;
  cin>>casos;
  for (int cas=0;cas<casos;cas++) {
    if (cas>0) cout<<endl;
    cin>>n>>m>>k;
    transponer=false;
    if (n>m) {
      swap(n,m);
      transponer=true;
    }
    v=vector<vector<int> > (n+2,vector<int> (m+2,0));
    int total=(n-1)+(n-1)*(m-2)*4+(n-1)*3;
    if (k>total or k==total-1 or k==total-2 or k==total-4 or k==total-5) {
      cout<<-1<<endl;
      continue;
    }
    if (k==total-8) {
      if (n>3) {
	cout<<-1<<endl;
	continue;
      }
      for (int i=1;i<=n;i++)
	for (int j=1;j<=m-1;j++)
	  v[i][j]=1;
      escribe();
      continue;
    }
    if (m==3 and k==6) {
      for (int i=1;i<=3;i++)
	for (int j=1;j<=3;j++)
	  v[i][j]=1;
      v[1][1]=v[2][1]=v[1][2]=0;
      escribe();
      continue;
    }
    genera();
  }
}

#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=100005;
int w[N],q[N],vis[N];
int n,m,k,fl,qq[N];
bool connect(){
	int h=0,t=1,cnt=0;
	For(i,1,n*m) vis[i]=0;
	For(i,1,n*m) if (w[i]) q[1]=i,++cnt;
	vis[q[1]]=1;
	while (h!=t){
		int x=q[++h];
		if (x+m<=n&&w[x+m]&&!vis[x+m])
			vis[x+m]=1,q[++t]=x+m;
		if (x-m>=1&&w[x-m]&&!vis[x-m])
			vis[x-m]=1,q[++t]=x-m;
		if (x%m!=0&&w[x+1]&&!vis[x+1])
			vis[x+1]=1,q[++t]=x+1;
		if (x%m!=1&&w[x-1]&&!vis[x-1])
			vis[x-1]=1,q[++t]=x-1;
	}
	return cnt==t;
}
int count(){
	int ans=0;
	For(i,1,(n-1)*m) if (i%m){
		ans+=w[i]&w[i+1]&w[i+m];
		ans+=w[i]&w[i+1]&w[i+1+m];
		ans+=w[i]&w[i+m]&w[i+1+m];
		ans+=w[i+1]&w[i+m]&w[i+1+m];
	}
	return ans;
}
int check(int p){
	For(i,1,n*m) w[i]=(i<=p);
	return count();
}
bool work(){
	int c=4*(n-1)*(m-1);
	if (k>c||k==c-1||k==c-2||k==c-4||k==c-5) return 0;
	if (k==c-8&&n!=3&&m!=3) return 0;
	int l=0,r=n*m,ans=0;
	while (l<=r){
		int mid=(l+r)/2;
		if (check(mid)<=k)
			ans=mid,l=mid+1;
		else r=mid-1;
	}
	check(ans);
	int cur=count(),top=0;
	if (cur==k) return 1;
	For(i,1,n*m)
		if ((i-1)/m==0||abs((i-1)/m-(ans-1)/m)<=1)
			qq[++top]=i;
	for (;cur^k;){
		int at,x;
		if (cur<k){
			for (;;){
				at=rand()%top+1;
				if (!w[qq[at]]) break;
			}
			x=qq[at]; w[x]=1;
			if (!connect()){
				w[x]=0; continue;
			}
			cur=count();
		}
		else{
			for (;;){
				at=rand()%top+1;
				if (w[qq[at]]) break;
			}
			x=qq[at]; w[x]=0;
			if (!connect()){
				w[x]=1; continue;
			}
			cur=count();
		}
	}
	return 1;
}
void solve(){
	scanf("%d%d%d",&n,&m,&k);
	int fl=(n<m);
	if (fl) swap(n,m);
	if (!work()) puts("-1");
	else if (fl){
		For(i,1,n){
			For(j,1,m) putchar(w[(i-1)*m+j]?'*':'.');
			puts("");
		}
	}
	else{
		For(i,1,m){
			For(j,1,n) putchar(w[(j-1)*m+i]?'*':'.');
			puts("");
		}
	}
	puts("");
}
int main(){
	srand(19*6*817);
	int T;
	scanf("%d",&T);
	while (T--) solve();
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int X1[4]={0,0,0,0};
int Y1[4]={-1,-1,1,1};
int X2[4]={-1,1,-1,1};
int Y2[4]={0,0,0,0};
int i,j,k,n,m,x,y,T,Cnt;
bool b[2010][2010],f,a[2010][2010];
inline int Check(){
	int Sum=0;
	for(int i=1;i<=n;i++)
	for(int j=1;j<=m;j++){
		if(!b[i][j])continue;
		for(int p=0;p<4;p++){
			x=i+X1[p];y=j+Y1[p];
			if(x<1||x>n||y<1||y>m||!b[x][y])continue;
			x=i+X2[p];y=j+Y2[p];
			if(x<1||x>n||y<1||y>m||!b[x][y])continue;
			Sum++;
		}
	}
	if(Sum==k)return 2;
	if(Sum<k)return 1;
	return 0;
}
inline void Dfs(int x,int y){
	if(++Cnt>(n*m*200000))return;
	if(f)return;
	int C=Check();
	if(!C)return;
	if(C==2){
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)a[i][j]=b[i][j];
		f=1;
		return;
	}
	if(y==m+1){
		Dfs(x+1,1);
		return;
	}
	if(x==n+1)return;
	b[x][y]=1;
	Dfs(x,y+1);
	b[x][y]=0;
	Dfs(x,y+1);
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&k);
		f=Cnt=0;Dfs(1,1);
		if(f)for(i=1;i<=n;i++){
			for(j=1;j<=m;j++)
			if(a[i][j])putchar('*');else putchar('.');
			putchar('\n');
		}else puts("-1");
		putchar('\n');
	}
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
bool hasans[5][5][100];
bool res[5][5][100][5][5];
vector<int> flag[100010];
int calc(int n,int m)
{
    int ret=0;
    for(int i=1;i<n;i++)
    {
        for(int j=1;j<m;j++)
        {
            int cur=flag[i][j]+flag[i+1][j]+flag[i][j+1]+flag[i+1][j+1];
            if(cur==4)ret+=4;
            else if(cur==3)ret++;
        }
    }
    return ret;
}
void init()
{
    for(int i=1;i<=4;i++)
    {
        for(int j=i;j<=4;j++)
        {
            for(int k=1;k<=i;k++)flag[k].resize(j+1);
            for(int k=0;k<(1<<(i*j));k++)
            {
                for(int l=1;l<=i;l++)
                {
                    for(int s=1;s<=j;s++)
                    {
                        if((k>>((l-1)*j+(s-1)))&1)flag[l][s]=1;
                        else flag[l][s]=0;
                    }
                }
                int vl=calc(i,j);
                if(!hasans[i][j][vl])
                {
                    hasans[i][j][vl]=1;
                    for(int l=1;l<=i;l++)
                    {
                        for(int s=1;s<=j;s++)res[i][j][vl][l][s]=flag[l][s];
                    }
                }
            }
        }
    }
}
int n,m,K;
void solve()
{
    scanf("%d%d%d",&n,&m,&K);
    if(K>(n-1)*(m-1)*4)
    {
        puts("-1\n");
        return;
    }
    if(n>m)swap(n,m);
    if(n<5&&m<5)
    {
        if(!hasans[n][m])puts("-1\n");
        else
        {
            for(int i=1;i<=n;i++)
            {
                for(int j=1;j<=m;j++)putchar(res[n][m][K][i][j]?'*':'.');
                putchar('\n');
            }
            putchar('\n');
        }
        return;
    }
    if(n==3&&m>=5&&K==2*(m-1)+8)
    {
        for(int i=1;i<=n;i++)
        {
            putchar('.');
            for(int j=2;j<=m;j++)putchar('*');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    if(!K)
    {
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=m;j++)putchar('.');
            putchar('\n');
        }
        putchar('\n');
        return;
    }
    for(int i=1;i<=n;i++)flag[i].resize(m+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)flag[i][j]=0;
    for(int i=1;i<=m;i++)flag[1][i]=1;
    int sk=K;
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            int fx,fy;
            if(j==1)fx=i-1,fy=m;
            else fx=i,fy=j-1;
            if(fx!=n&&K<4)
            {
                if(K==1)
                {
                    if(fy>=2)flag[fx+1][1]=1;
                    else flag[fx][m]=1;
                }
                else if(K==2)
                {
                    if(fy>=3)flag[fx+1][2]=1;
                    else flag[fx][m-1]=1;
                }
                else if(K==3)
                {
                    if(fy==m)flag[fx+1][2]=1,flag[fx+1][m]=1;
                    else if(fy==m-1)flag[fx][m]=1;
                    else if(fy>=3)flag[fx+1][2]=1,flag[fx][m]=1;
                    else flag[fx+1][1]=1,flag[fx][m-1]=1;
                }
                goto output;
            }
            else if(K<4||fy==m-5)
            {
                for(int k=0;k<32;k++)
                {
                    for(int l=0;l<5;l++)flag[i][j+l]=(k>>l)&1;
                    if(calc(n,m)==sk)goto output;
                }
                puts("-1\n");
                return;
            }
            if(j==1)K--;
            else if(j==m)K-=3;
            else K-=4;
            flag[i][j]=1;
        }
    }
    output:
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            putchar(flag[i][j]?'*':'.');
        }
        putchar('\n');
    }
    putchar('\n');
}
int T;
int main()
{
    init();
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int xx[N],yy[N],yes[N],n,m,cnt,now,flag,x,y,X,Y,K;
vi a[N];

int calc(int x,int y){
	int res=0;
	res+=a[x-1][y-1]&a[x-1][y];
	res+=a[x-1][y-1]&a[x][y-1];
	res+=a[x-1][y]&a[x][y-1];
	res+=a[x-1][y]&a[x-1][y+1];
	return res;
}

int chk(int s){
	static int q[N];
	int l=0,r=0;
	rep(i,1,cnt){
		a[xx[i]][yy[i]]=0;
		yes[i]=0;
		if(!(s>>(i-1)&1)) continue;
		if(xx[i]==x||xx[i]==x+1&&yy[i]<=y) yes[i]=1,q[r++]=i;
	}
	while(l<r){
		int u=q[l++];
		rep(v,1,cnt)if(s>>(v-1)&1){
			if(!yes[v]&&abs(xx[u]-xx[v])+abs(yy[u]-yy[v])==1){
				yes[v]=1,q[r++]=v;
			}
		}
	}
	rep(i,1,cnt) if((s>>(i-1)&1)&&!yes[i]) return 0;
	int sum=now;
	rep(i,1,cnt) if(s>>(i-1)&1) sum+=calc(xx[i],yy[i]),a[xx[i]][yy[i]]=1;
	return sum==K;
}

void rmain(){
	read(n),read(m),read(K);
	if(n<m) swap(n,m),flag=1;
	rep(i,0,n+1) a[i].clear(),a[i].resize(m+2);
	now=0,x=n,y=m;
	int rem=n*m;
	rep(i,1,n){
		int owo=0;
		rep(j,1,m){
			int nxt=calc(i,j); rem--;
			if(now+nxt<=K&&rem>=10) now+=nxt,a[i][j]=1;
			else {x=i,y=j-1; if(y==0)y=m,x--; owo=1;break;}
		}
		if(owo) break;
	}
	cnt=0,X=x,Y=y;
	while(cnt<10){
		Y++; if(Y>m) X++,Y=1;
		if(X>n) break;
		xx[++cnt]=X,yy[cnt]=Y;
	}
	int found=0;
	for(int s=1;s<(1<<cnt);s++)
		if(chk(s)){
			found=1;
			break;
		}
	if(!found){
		puts("-1");
		return;
	}
	if(flag) swap(n,m);
	rep(i,1,n){
		rep(j,1,m) printf("%c",(flag?a[j][i]:a[i][j])?'*':'.');
		puts("");
	}
}

int main(){
	int T; read(T);
	while(T--) rmain();
	return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
using namespace std;
int X1[4]={0,0,0,0};
int Y1[4]={-1,-1,1,1};
int X2[4]={-1,1,-1,1};
int Y2[4]={0,0,0,0};
int X[4]={0,0,1,-1};
int Y[4]={1,-1,0,0};
int i,j,k,n,m,x,y,T,Cnt,xx,yy;
bool f,F,f2;
map<int,bool>b[200010],a[200010];
inline int Calc(int x,int y){
	int Ans=0;
	for(int p=0;p<4;p++){
		int xx=x+X1[p],yy=y+Y1[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		xx=x+X2[p];yy=y+Y2[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		Ans++;
	}
	return Ans;
}
inline void Dfs(int x,int y,int Sum){
	if(++Cnt>(n*m*10)||f||Sum>k)return;
	if(Sum==k){
		f=1;
		for(int i=1;i<=n;i++)
		for(int j=1;j<=m;j++)a[i][j]=b[i][j];
		return;
	}
	if(y==m+1)x++,y=1;
	if(x==n+1)return;
	bool f3=0;
	for(int p=0;p<4;p++){
		xx=x+X[p];yy=y+Y[p];
		if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
		f3=1;break;
	}
	if(!f2||f3){
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum-=Calc(xx,yy);
		}
		int s=Sum;
		b[x][y]=1;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			Sum+=Calc(xx,yy);
		}
		Dfs(x,y+1,Sum+Calc(x,y));
		f2=1;
		b[x][y]=0;
		for(int p=0;p<4;p++){
			xx=x+X[p];yy=y+Y[p];
			if(xx<1||xx>n||yy<1||yy>m||!b[xx][yy])continue;
			s+=Calc(xx,yy);
		}
		Dfs(x,y+1,s);
	}else{
		b[x][y]=0;
		Dfs(x,y+1,Sum);
	}
}
int main(){
	scanf("%d",&T);
	while(T--){
		scanf("%d%d%d",&n,&m,&k);
		F=0;
		if(n<m)swap(n,m),F=1;
		f=Cnt=f2=0;Dfs(1,1,0);
		if(f){
			if(F)
			for(i=1;i<=m;i++){
				for(j=1;j<=n;j++)
				if(a[j][i])putchar('*');else putchar('.');
				putchar('\n');
			}else
			for(i=1;i<=n;i++){
				for(j=1;j<=m;j++)
				if(a[i][j])putchar('*');else putchar('.');
				putchar('\n');
			}
		}else puts("-1");
		putchar('\n');
	}
	return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>

using namespace std;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define epr(...) fprintf(stderr, __VA_ARGS__)
#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"
#define all(a) (a).begin(), (a).end()

#define equal equalll
#define less lesss
const int N = -1;
const long long INF = 1e9 + 19;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int n, m, k;

void read() {
    scanf("%d%d%d", &n, &m, &k);
    //db3(n, m, k);
}
set < pair < int, int > > forCheck;

int getAll(int n, int m) {
    return 4 * (n - 1) * (m - 1);
}

bool check(int x, int y) {
    return 0 <= x && x < n && 0 <= y && y < m;
}

vector<pair<int,int>> norm(pair<int,int> p1, pair<int,int> p2, pair<int,int> p3) {
    if (p2 > p3) swap(p2, p3);
    return {p1, p2, p3};
}

map < pair < pair < int, int>, int > , vector<vector<char>> > cache;

void print(vector < vector < char > > board, bool flagSwap) {
    if (flagSwap == 0) {
        cache[mp(mp(n, m), k)] = board;
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[i][j]);
    }
    else {
        swap(n, m);
        for (int i = 0; i < n; i++, puts(""))
            for (int j = 0; j < m; j++)
                printf("%c", board[j][i]);
    }
}

int calcRes(const vector<vector<char>>& board) {
    int res = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            for (int id = 0; id < 4; id++) {
                int x1 = i + dx[id];
                int y1 = j + dy[id];
                int x2 = i + dx[(id + 1) % 4];
                int y2 = j + dy[(id + 1) % 4];
                if (check(x1, y1) && check(x2, y2) && board[i][j] == '*' && board[x1][y1] == '*' && board[x2][y2] == '*') {
                    res++;
                }
            }
        }
    return res;
}

bool uu[10][10];
int cc;

void dfs(int x, int y, const set<pair<int,int>>& blocked) {
    uu[x][y] = 1;
    cc++;
    for (int i = 0; i < 4; i++) {
        int x1 = x + dx[i];
        int y1 = y + dy[i];
        if (check(x1, y1) && !uu[x1][y1] && blocked.count(mp(x1, y1)) == 0) {
            dfs(x1, y1, blocked);
        }
    }
}

bool brute() {
    vector < pair < int, int > > data(all(forCheck));
    int sz = data.size();
    set < pair < int, int > > g;
    for (auto p: data) {
        for (int i = 0; i < 4; i++) {
            int x = p.fr + dx[i];
            int y = p.sc + dy[i];
            g.insert(mp(x, y));
        }
    }
    set < vector < pair < int, int > > > tri;

    for (auto p: g) {
        for (int i = 0; i < 4; i++) {
            int x1 = p.fr + dx[i];
            int y1 = p.sc + dy[i];
            int x2 = p.fr + dx[(i + 1) % 4];
            int y2 = p.sc + dy[(i + 1) % 4];
            if (check(p.fr, p.sc) && check(x1, y1) && check(x2, y2))
                tri.insert(norm(p, mp(x1, y1), mp(x2, y2)));
        }
    }

    for (int mask = 0; mask < (1 << sz); mask++) {
        //mask = 27;
        set<pair<int,int>> blocked;
        for (int i = 0; i < sz; i++)
            if (((mask >> i) & 1) == 0) {
                blocked.insert(data[i]);
            }
        int cnt = getAll(n, m);
        for (auto tr: tri) {
            bool flag = 0;
            flag |= blocked.count(tr[0]) == 1;
            flag |= blocked.count(tr[1]) == 1;
            flag |= blocked.count(tr[2]) == 1;
            cnt -= flag;
        }
        bool con = 1;
        if (n * m <= 16) {
            memset(uu, 0, sizeof(uu));
            bool ff = 0;
            for (int i = 0; !ff && i < n; i++)
                for (int j = 0; !ff && j < m; j++) {
                    if (blocked.count(mp(i, j)) == 0) {
                        cc = 0;
                        dfs(i, j, blocked);
                        //db2(cc + blocked.size(), n * m);
                        if (cc + (int)blocked.size() == n * m)
                            con = 1;
                        else
                            con = 0;
                        ff = 1;
                        break;
                    }
                }
        }
        //db3(con, cnt, k);
        if (cnt == k && con) {
            vector<vector<char>> board(n, vector<char>(m, '*'));
            for (auto p: blocked)
                board[p.fr][p.sc] = '.';
            assert(calcRes(board) == k);
            print(board, 0);
            return 1;
        }
        //exit(0);
    }
    return 0;
}

void solve() {
    if (cache.count(mp(mp(n, m), k)) == 1) {
        print(cache[mp(mp(n, m), k)], 0);
        return;
    }
    if (k == 0) {
        vector<vector<char>> board(n, vector<char>(m, '.'));
        board[0][0] = '*';
        print(board, 0);
        return;
    }
    forCheck.clear();
    if (n * m <= 16) {
        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                forCheck.insert(mp(i, j));
        if (brute())
            return;
        else {
            puts("-1");
            return;
        }
    }
    else {
        forCheck.clear();
        for (int i = 0; i < 3; i++){
            forCheck.insert(mp(0, i));
            forCheck.insert(mp(0, m - 1 - i));
        }
        if (brute())
            return;
        forCheck.clear();
        for (int i = 0; i < 3; i++){
            forCheck.insert(mp(i, 0));
            forCheck.insert(mp(n - 1 - i, 0));
        }
        if (brute())
            return;
    }

    bool flagSwap = 0;
    if (n > m) {
        swap(n, m);
        flagSwap = 1;
    }

    if (k > getAll(n, m)) {
        puts("-1");
        return;
    }
    int cur = 1;
    for (; getAll(cur + 1, m) <= k; cur++);

    assert(m >= 5);
    int curM = 0;
    int need = k - getAll(cur, m);
    //db(need);
    for (; ((curM + 1) - 1) * 4 + 1 <= need; curM++);

    if (curM >= 1)
        need -= (curM - 1) * 4 + 1;

    //db(need);
    vector<vector<char>> board(n, vector<char>(m, '.'));
    for (int i = 0; i < cur; i++)
        for (int j = 0; j < m; j++)
            board[i][j] = '*';
    for (int j = 0; j < curM; j++)
        board[cur][j] = '*';
    int xup = min(need, m - curM - 1);

    need -= xup;
    for (int j = m - xup; j < m; j += 2)
        board[cur][j] = '*';

    //print(board, 0);
    //db(need);

    if (need > 0 && cur + 1 < n) {
        //assert(cur + 1 < n);
        for (int j = need - 1; j >= 0; j -= 2)
            board[cur + 1][j] = '*';
        assert(need < curM);
        need = 0;
    }
    int res = calcRes(board);
    assert(res + need == k);

    if (need == 0) {
        print(board, flagSwap);
        return;
    }
    else
        puts("-1");

}

void stress() {
    n = 4;
    m = 4;
    int T = (n - 1) * (m - 1) * 4;
    for (int t = 0; t <= T; t++) {
        k = t;
        db3(n, m, k);
        solve();
    }
}

int main(){
#ifdef MY_DEBUG
    freopen("in", "r", stdin);
    //freopen("test.txt", "r", stdin);
    //freopen("out", "w", stdout);
#endif
    //printf(".*.\n***\n.*.\n\n");
    //printf("**.\n**.\n*..\n\n");
    //printf(".*.\n***\n*..\n");
    //return 0;
    if (0) {
        int k = 1;
        scanf("%d", &k);
        for (int tt = 0; tt < k; tt++) {
            //db(tt);
            read();
            solve();
            if (tt + 1 != k)
                puts("");
        }
    }
    else {
        stress();
    }

    return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 100000;

int n, m, K;

vector<int> ret[maxn + 5];

const int walk[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
bool vis[5][5];
bool g[5][5];

void dfs(int x, int y)
{
	vis[x][y] = 1;
	REP(i, 0, 4)
	{
		int u = x + walk[i][0], v = y + walk[i][1];
		if (u < 0 || u >= n || v < 0 || v >= m) continue;
		if (g[u][v] && !vis[u][v]) dfs(u, v);
	}
}

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d%d%d", &n, &m, &K);
		if (n <= 4 && m <= 4)
		{
			bool find = 0;
			REP(i, 1, (1 << (n * m)))
			{
				REP(j, 0, n) REP(k, 0, m) g[j][k] = (i >> (j * m + k) & 1);
				int cnt = 0;
				memset(vis, 0, sizeof vis);
				REP(j, 0, n) REP(k, 0, m) if (g[j][k] && !vis[j][k]) dfs(j, k), ++cnt;
				if (cnt > 1) continue;
				int tot = 0;
				REP(j, 0, n - 1) REP(k, 0, m - 1)
				{
					int tmp = g[j][k] + g[j + 1][k] + g[j][k + 1] + g[j + 1][k + 1];
					if (tmp == 3) ++tot;
					else if (tmp == 4) tot += 4;
				}
				if (tot == K)
				{
					find = 1;
					REP(j, 0, n)
					{
						REP(k, 0, m)
						{
							if (g[j][k]) putchar('*');
							else putchar('.');
						}
						putchar('\n');
					}
					putchar('\n');
					break;
				}
			}
			if (!find) puts("-1\n");
			continue;
		}
		if (K > ((n - 1) * (m - 1) << 2))
		{
			puts("-1\n");
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2))
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar('*');
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2) - 8)
		{
			if (n == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!j ? '.' : '*');
					putchar('\n');
				}
			}
			else if (m == 3)
			{
				REP(i, 0, n)
				{
					REP(j, 0, m) putchar(!i ? '.' : '*');
					putchar('\n');
				}
			}
			else puts("NO");
			putchar('\n');
			continue;
		}
		else if (!K)
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((!i && !j ? '*' : '.'));
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		bool rev = 0;
		if (n > m) swap(n, m), rev = 1;
		REP(i, 0, n) ret[i] = vector<int>(m, 0);
		bool failed = 0;
		--K;
		REP(i, 0, m) ret[0][i] = 1;
		int px = 0, py = m - 1;
		REP(i, 1, n) REP(j, 1, m)
		{
			if (K < 4) break;
			px = i, py = j;
			ret[i][j] = 1;
			K -= 4;
		}
		if (py == m - 1) ++px, py = 0;
		REP(i, 0, px + 1) ret[i][0] = 1;
		if (K == 1)
		{
			if (px != n - 1)
			{
				if (py >= 1) ret[px + 1][0] = 1;
				else ret[px][m - 1] = 1;
			}
			else if (py < m - 2) ret[n - 1][m - 1] = 1;
			else failed = 1;
		}
		else if (K == 2)
		{
			if (px != n - 1)
			{
				if (py >= 2) ret[px + 1][1] = 1;
				else ret[px][m - 2] = 1;
			}
			else if (py < m - 3) ret[px][m - 2] = 1;
			else failed = 1;
		}
		else if (K == 3)
		{
			if (px != n - 1)
			{
				if (py >= 3) ret[px + 1][0] = ret[px + 1][py - 1] = 1;
				else if (py == 2) ret[px + 1][1] = ret[px][m - 1] = 1;
				else if (py == 1) ret[px + 1][0] = ret[px][m - 2] = 1;
				else ret[px][m - 3] = ret[px][m - 1] = 1;
			}
			else if (py < m - 4) ret[px][m - 3] = ret[px][m - 1] = 1;
			else failed = 1;
		}
		if (rev) swap(n, m);
		if (failed)
		{
			puts("-1");
		}
		else
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((rev ? ret[j][i] : ret[i][j]) ? '*' : '.');
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;
int main() {
	int T;
	cin >> T;
	bool sheep=false;
	while (T--) {
		if (sheep)
			cout << endl;
		else
			sheep = true;
		int n,m,k;
		cin >> n >> m >> k;
		int max = 4*(n-1)*(m-1);
		int gap = max-k;
		if (k>4*(n-1)*(m-1)) {
			cout << -1 << endl;
			continue;
		}
		if (k==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << ".";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==0) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==1 or gap==2 or gap==4 or gap==5) {
			cout << -1 << endl;
			continue;
		}
		if (gap==3) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-1 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==6) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==7) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if ((i==n-2 or i==n-1) and j==m-1)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		if (gap==8) {
			if (m>3 and n>3) {
				cout << -1 << endl;
				continue;
			}
			else {
				if (m==3)
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (i==n-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
				else
					for (int i=0; i<n; i++) {
						for (int j=0; j<m; j++) {
							if (j==m-1)
								cout << ".";
							else
								cout << "*";
						}
						cout << endl;
					}
			}
			continue;
		}
		if (gap==12) {
			for (int i=0; i<n; i++) {
				for (int j=0; j<m; j++) {
					if (i==n-2 and j==m-2)
						cout << ".";
					else
						cout << "*";
				}
				cout << endl;
			}
			continue;
		}
		bool a[n][m];
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				a[i][j] = false;
			}
		}
		for (int i=0; i<m-1; i++) {
			a[1][i] = true;
		}
		int maxOne = 4*((m-2)*(n-2)-1)+1+3;
		int maxTwo = maxOne + 4*((m-4)*(m>3)+(n-4)*(n>3))+(m>3)+(n>3);
		int maxThree = maxTwo + 3;
		int maxFour = maxThree + 3*(m>3);
		if (k<=maxOne) {
			int squares = (k-1)/4;
			int residue = (k-1)%4;
			int s=0;
			while (squares--) {
				a[s/(n-2)+2][m-s%(n-2)-3] = true;
				s++;
			}
			for (int i=1; i<n-1; i++) {
				if (a[i][0])
					a[i+1][m-2]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
		} else if (k<=maxTwo) {
			int residue = (k-(m>3)-(n>3)-1)%4;
			int bonusSquares = (k-maxOne+3-(m>3)-(n>3))/4;
			int ii = n-2;
			int jj = 1;
			while (bonusSquares--) {
				if (jj<m-3) {
					a[0][jj]=true;
					jj++;
				} else if (ii>2) {
					a[ii][0]=true;
					ii--;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					if (i!=n-1 or j!=0)
						a[i][j]=true;
				}
			}
		} else if (k<=maxThree) {
			a[n-1][0]=true;
			int residue = (k-maxTwo)%4;
			if (residue==1) {
				a[0][m-2]=true;
			} else if (residue==2) {
				a[0][m-2]=true;
				a[0][m-1]=true;
			} else if (residue==3) {
				a[0][m-2]=true;
				a[1][m-1]=true;
			}
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			if (m>3) {
				a[0][0]=true;
			}
			if (n>3) {
				a[n-1][m-1]=true;
			}
		} else if (k<=maxFour) {
			a[0][m-3]=true;
			int gapFour = k-maxThree-1;
			if (gapFour>0)
				a[1][m-1]=true;
			if (gapFour>1)
				a[0][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		} else if (k<=(maxFour+3)) {
			a[0][m-3]=true;
			a[0][m-2]=true;
			int gapFive = k-maxFour-1;
			if (gapFive==1)
				a[0][m-1]=true;
			else if (gapFive==2)
				a[1][m-1]=true;
			for (int i=1; i<n; i++) {
				for (int j=0; j<m-1; j++) {
					a[i][j]=true;
				}
			}
			for (int i=n-1; i>2; i--) {
				a[i][m-1]=true;
			}
			for (int i=0; i<m-3; i++) {
				a[0][i]=true;
			}
		}
		for (int i=0; i<n; i++) {
			for (int j=0; j<m; j++) {
				if (a[i][j])
					cout << "*";
				else
					cout << ".";
			}
			cout << endl;
		}
	}

	return 0;
}

//*
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <numeric>
#include <functional>
#define MOD 1000000007
#define MAX 0x3f3f3f3f
#define MAX2 0x3f3f3f3f3f3f3f3fll
#define ERR 1e-10
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#pragma warning(disable:4996)
using namespace std;

typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;

int n, m, p;

void doprint(vector<vector<int>> &a, int swapy)
{
	if(!swapy)
	{
		for(auto e : a)
		{
			for(auto f : e) printf("%c", f?'*':'.');
			printf("\n");
		}
	}
	else
	{
		for(int i=0;i<a[0].size();i++)
		{
			for(int j=0;j<a.size();j++)
			{
				printf("%c", a[j][i]?'*':'.');
			}
			printf("\n");
		}
	}
}

int dodo()
{
	int i, j, k, l;
	cin>>n>>m>>p;
	vector<vector<int>> a;
	a.resize(n);
	for(i=0;i<n;i++) a[i].resize(m);
	if(n <= 4 && m <= 4)
	{
		for(i=1;i<(1<<n*m);i++)
		{
			for(j=0;j<n*m;j++) a[j/m][j%m]=!!(i&(1<<j));
			int cnt=0;
			for(j=0;j<n-1;j++) for(k=0;k<m-1;k++)
			{
				int u=a[j][k]+a[j][k+1]+a[j+1][k]+a[j+1][k+1];
				if(u == 3) cnt++;
				else if(u == 4) cnt+=4;
			}
			if(cnt == p)
			{
				for(j=0;j<n;j++)
				{
					for(k=0;k<m;k++) printf("%c", a[j][k]?'*':'.');
					printf("\n");
				}
				return 0;
			}
		}
		return !printf("-1\n");
	}

	int swapy=0;
	if(m <= 4) swap(n, m), swapy=1;
	a.resize(n);
	for(i=0;i<n;i++) a[i].resize(m);
	if(n == 3 && p == 4*(n-1)*(m-1)-8)
	{
        for(i=1;i<m;i++) for(j=0;j<3;j++) a[j][i]=1;
        doprint(a, swapy);
        return 0;
	}
    int now=0;
    for(i=0;i<m;i++) a[0][i]=1;
    for(i=1;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(i == n-1 && j == m-4) break;
			a[i][j]=1;
			if(j == 0) now++;
			else if(j == m-1) now+=3;
			else now+=4;
            if(p-now < 4)
			{
				if(i < n-1)
				{
					if(p-now == 0);
					else if(p-now == 1)
					{
						if(j >= 1) a[i+1][0]=1;
						else a[i][m-1]=1;
					}
					else if(p-now == 2)
					{
						if(j == 0) a[i][m-1]=a[i+1][0]=a[i+1][1]=1;
						else if(j == 1) a[i+1][0]=a[i][m-1]=1;
						else a[i+1][0]=a[i+1][j]=1;
					}
					else
					{
						if(j == 0) a[i+1][0]=a[i+1][1]=a[i][m-2]=1;
						else if(j == 1) a[i+1][0]=a[i][m-2]=1;
						else if(j == 2) a[i+1][1]=a[i][m-1]=1;
						else a[i+1][0]=a[i+1][j-1]=1;
					}
					doprint(a, swapy);
					return 0;
				}
				else
				{
					if(p-now == 0);
					else if(p-now == 1) a[i][m-1]=1;
					else if(p-now == 2) a[i][m-2]=1;
					else if(p-now == 3) a[i][m-3]=a[i][m-1]=1;
					doprint(a, swapy);
					return 0;
				}
			}
		}
	}
	map<int, string> mq;
	mq[0]="0000";
	mq[1]="0001";
	mq[2]="0010";
	mq[3]="0101";
	mq[4]="1000";
	mq[5]="1001";
	mq[6]="1010";
	mq[8]="1100";
	mq[9]="1101";
	mq[12]="1110";
	mq[15]="1111";
	if(mq.count(p-now))
	{
		for(i=0;i<4;i++) a[n-1][m-4+i]=mq[p-now][i]-'0';
		doprint(a, swapy);
	}
	else return !printf("-1\n");
}

int main()
{
	int i, j, k, l;
	int T;
	cin>>T;
	while(T--)
	{
		dodo();
		printf("\n");
	}
	return 0;
}
//*/

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py != m - 1) {
				a[px][1] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			return 0;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < n - 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else if (py == 1) {
					if (m != 3)
						a[px + 1][py] = a[px + 1][py + 1] = 1 , a[px][m - 1] = 1;
					else
						a[px + 1][py] = a[px + 1][py + 1] = a[px][m] = a[px + 1][m] = 1;
				}
				else
					a[px][py + 2] = 1 , a[px + 1][py] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			if (py == 1)
			{
				if (n == 3)
				{
					if (m == 3)
						return 0;
					a[1][m] = 0 , a[2][m] = 0;
					a[3][m - 1] = 1;
					if (m == 4) a[3][2] = 1;
					else a[3][2] = 1 , a[2][m] = 1;
					return 1;
				}
			}

			if (m - py <= 3)
				return 0;

			a[1][1] = a[1][m] = a[2][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
bool __barr[550055], *__pbarr=__barr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }
inline bool* newbool(const unsigned int SZ) {
	__pbarr += SZ;
	return __pbarr - SZ;
}
inline void initbool() { __pbarr=__barr; }
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

char DB[5][5][37][4][4];

char *A[100005];
bool *chk[100005];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void dfs(int y, int x) {
	chk[y][x] = true;
	for(int dr = 0; dr < 4; dr++) {
		int ny = y+dy[dr], nx = x+dx[dr];
		if('*' != A[ny][nx] || chk[ny][nx]) continue;
		dfs(ny, nx);
	}
}
bool isConnected(int H, int W) {
	initbool();
	for(int i = 0; i <= H+1; i++)
		chk[i] = newbool(W+2);
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	bool flag = false;
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++) {
			if('*' == A[i][j]) {
				flag = true;
				dfs(i, j);
				break;
			}
		}
		if(flag) break;
	}

	if(!flag) return false;

	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('*' == A[i][j] && !chk[i][j]) return false;
	return true;
}

void printAnswer(int H, int W) {
	initbool();
	for(int i = 0; i <= H+1; i++)
		chk[i] = newbool(W+2);
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	dfs(1, 1);

	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar('*' == A[i][j] && chk[i][j] ? '*' : '.');
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);
			if(!isConnected(h, w)) continue;

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		if((H-1) * (W-2) * 4 == N) {
			for(int i = 1; i <= H; i++) {
				for(int j = 1; j < W; j++)
					putchar('*');
				puts(".");
			}
			continue;
		}

		if((H-2) * (W-1) * 4 == N) {
			for(int i = 1; i < H; i++) {
				for(int j = 1; j <= W; j++)
					putchar('*');
				puts("");
			}
			for(int j = 1; j <= W; j++)
				putchar('.');
			puts("");
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						bool iscon = true, niscon = true;

						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;
							if('*' != A[i-1][j+k] && '*' != A[i][j+k-1]) iscon = false;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
						}

						if(sum+nsum == N && iscon && niscon && isConnected(H, W)) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0; niscon = true;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;
							if('*' != A[i-1][W] && '*' != A[i][W-1]) iscon = false;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
								if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
							}

							if(sum+nsum == N && iscon && niscon && isConnected(H, W)) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <deque>
#include <queue>
#include <cstring>
#include <set>
#include <list>
#include <map>
#include <random>
#include <unordered_map>
#include <stdio.h>

using namespace std;

typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<bool> vb;
typedef std::vector<string> vs;
typedef std::vector<double> vd;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<int> > vvi;
typedef vector<vvi> vvvi;
typedef vector<vll> vvll;
typedef std::vector<std::pair<int, int> > vpi;
typedef vector<vpi> vvpi;
typedef std::pair<int, int> pi;
typedef std::pair<ll, ll> pll;
typedef std::vector<pll> vpll;

const long long mod = 1000000007;

#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c).size()
#define forn(i, a, b) for(int i = a; i < b; i++)

#define pb push_back
#define mp make_pair

int n,m,k;
vvi a;
int cur;
bool add(int x, int y) {
    if(x==0) {
        a[x][y] = 1;
        return true;
    }
    if(y == 0) {
        if(a[x-1][0] + a[x-1][1] == 2) cur++;
        a[x][y] = 1;
        return true;
    }
    int inc = 0;
    if(a[x-1][y] + a[x-1][y-1] == 2) inc++;
    if(a[x][y-1] + a[x-1][y-1] == 2) inc++;
    if(a[x-1][y] + a[x][y-1] == 2) inc++;
    if(y < m-1 && a[x-1][y] + a[x-1][y+1] == 2) inc++;
    if(inc == 0) {
        if(a[x][y-1] == 0 && a[x-1][y] == 0 && y == m-1) return false;
    }
    if(cur+inc <= k) {
        cur+=inc;
        a[x][y] = 1;
        return true;
    }
    else return false;
}

int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
#endif
    int t;
    cin>>t;
    forn(aff,0,t) {

        cin>>n>>m>>k;
        cur = 0;
        a=vvi(n,vi(m,0));
        int best = (n-1)*(m-1)*4;
        if(k>best || k==best -1 || k==best -2 || k==best-5 || k==best-4) {
            printf("-1\n");
            if(aff<t-1) printf("\n");
            continue;
        }
        bool f = false;
        forn(i,0,n) {
            if(cur == k) break;
            forn(j,0,m) {
                add(i,j);
                if(cur==k) break;
            }
        }
        if(cur<k) {
            if(a[n-2][m-1] == 0) {
                a[n-1][0]=0;
                a[n-1][1]=1;
                a[n-1][2]=1;
                cur = k;
            }
        }
        if(cur<k) {
            printf("-1\n");
            if(aff<t-1) printf("\n");
            continue;
        }
        forn(i,0,n) {
            forn(j,0,m) {
                if(a[i][j]) printf("*");
                else printf(".");
            }
            printf("\n");
        }
        if(aff<t-1) printf("\n");

    }
}

/*
	I will chase the meteor for you, a thousand times over.
	Please wait for me, untill I fade forever.
	Just 'coz GEOTCBRL.
*/
#include <bits/stdc++.h>
using namespace std;
#define fore(i,u)  for (int i = head[u] ; i ; i = nxt[i])
#define rep(i,a,b) for (int i = a , _ = b ; i <= _ ; i ++)
#define per(i,a,b) for (int i = a , _ = b ; i >= _ ; i --)
#define For(i,a,b) for (int i = a , _ = b ; i <  _ ; i ++)
#define Dwn(i,a,b) for (int i = ((int) a) - 1 , _ = (b) ; i >= _ ; i --)
#define fors(s0,s) for (int s0 = (s) , _S = s ; s0 ; s0 = (s0 - 1) & _S)
#define foreach(it,s) for (__typeof(s.begin()) it = s.begin(); it != s.end(); it ++)

#define mp make_pair
#define pb push_back
#define pii pair<int , int>
#define fir first
#define sec second
#define MS(x,a) memset(x , (a) , sizeof (x))

#define gprintf(...) fprintf(stderr , __VA_ARGS__)
#define gout(x) std::cerr << #x << "=" << x << std::endl
#define gout1(a,i) std::cerr << #a << '[' << i << "]=" << a[i] << std::endl
#define gout2(a,i,j) std::cerr << #a << '[' << i << "][" << j << "]=" << a[i][j] << std::endl
#define garr(a,l,r,tp) rep (__it , l , r) gprintf(tp"%c" , a[__it] , " \n"[__it == _])

template <class T> inline void upmax(T&a , T b) { if (a < b) a = b ; }
template <class T> inline void upmin(T&a , T b) { if (a > b) a = b ; }

typedef long long ll;

const int maxn = 100007;
const int maxm = 200007;
const int mod = 1000000007;
const int inf = 0x7fffffff;
const double eps = 1e-7;

typedef int arr[maxn];
typedef int adj[maxm];

inline int fcmp(double a , double b) {
	if (fabs(a - b) <= eps) return 0;
	if (a < b - eps) return -1;
	return 1;
}

inline int add(int a , int b) { return ((ll) a + b) % mod ; }
inline int mul(int a , int b) { return ((ll) a * b) % mod ; }
inline int dec(int a , int b) { return add(a , mod - b % mod) ; }
inline int Pow(int a , int b) {
	int t = 1;
	while (b) {
		if (b & 1) t = mul(t , a);
		a = mul(a , a) , b >>= 1;
	}
	return t;
}

#define gc getchar
#define idg isdigit
#define rd RD<int>
#define rdll RD<long long>
template <typename Type>
inline Type RD() {
	char c = getchar(); Type x = 0 , flag = 1;
	while (!idg(c) && c != '-') c = getchar();
	if (c == '-') flag = -1; else x = c - '0';
	while (idg(c = gc()))x = x * 10 + c - '0';
	return x * flag;
}
inline char rdch() {
	char c = gc();
	while (!isalpha(c)) c = gc();
	return c;
}
#undef idg
#undef gc

// beginning

int flag , n , m , tot;

vector<vector<int> > a;

void input() {
	flag = 0;
	n = rd() , m = rd() , tot = rd();
	if (n > m) swap(n , m) , flag = 1;
	a.resize(n + 1);
	rep (i , 0 , n) a[i].resize(m + 1);
	rep (i , 0 , n) fill(a[i].begin() , a[i].end() , 0);
}

inline int calc() {
	int ret = 0;
	rep (x , 1 , n - 1) rep (y , 1 , m - 1)
		ret += (a[x][y] & a[x + 1][y] & a[x][y + 1])
			  +(a[x][y] & a[x + 1][y] & a[x + 1][y + 1])
			  +(a[x][y] & a[x][y + 1] & a[x + 1][y + 1])
			  +(a[x + 1][y] & a[x][y + 1] & a[x + 1][y + 1]);
	return ret;
}

inline int check(int cor) {
	rep (i , 1 , n) rep (j , 1 , m) a[i][j] = 0;
	rep (i , 1 , cor) {
		int x = (i - 1) / m + 1 , y = (i - 1) % m + 1;
		a[x][y] = 1;
	}
	return calc();
}

inline bool work() {
	int l = 1 , r = n * m;
	int p = 0;
	while (l <= r) {
		int m = (l + r) >> 1;
		if (check(m) <= tot)
			upmax(p , m) , l = m + 1;
		else
			r = m - 1;
	}

	tot -= check(p);
	if (!tot)
		return 1;
	if (p == n * m)
		return 0;

	int px = (p - 1) / m + 1 , py = (p - 1) % m + 1;
//	gprintf("%d %d\n" , px , py);

	switch (tot)
	{
		case 1:
		{
			if (px != n)
			{
				if (py == 1)
					a[px][m] = 1;
				else
					a[px + 1][py] = 1;
				return 1;
			}

			if (py == 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = 1;
				return 1;
			}

			if (n == 3 && m == 3) return 0;

			a[px][1] = 0;
			a[px][py + 1] = 1;

			return 1;
		}

		case 2:
		{
			if (px != n)
			{
				if (py != 1)
					a[px + 1][py] = a[px + 1][py + 1] = 1;
				else
					a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px][m] = 1;
				return 1;
			}

			if (py == 1)
			{
				if (m == 3) return 0;
				/*a[px][py] = 0 , */a[px][py + 2] = 1;
				return 1;
			}

			if (py < n - 1)
			{
				a[px][py] = 0;
				a[px][py + 1] = a[px][py + 2] = 1;
				return 1;
			}

			return 0;
		}

		case 3:
		{
			if (px < n)
			{
				if (py == m - 1)
					a[px][py + 1] = 1;
				else
					a[px][py + 2] = 1 , a[px + 1][py] = 1 , a[px + 1][py + 1] = 1 , a[px + 1][py + 2] = 1;
				return 1;
			}

			if (py == 1 && n == 3)
			{
				if (m == 3)
					return 0;
				a[1][m] = 0 , a[2][m] = 0;
				a[3][m - 1] = 1;
				if (m == 4) a[3][2] = 1;
				else a[3][2] = 1 , a[2][m] = 1;
				return 1;
			}

			if (m - py <= 3)
				return 0;

			a[1][1] = a[1][m] = a[2][m] = 0;
			a[px][py + 1] = a[px][py + 2] = a[px][py + 3] = 1;
			return 1;
		}
	}
}

inline char ch(int x) {
	return x ? '*' : '.';
}

void solve() {
	if (4 * (n - 1) * (m - 1) >= tot && work()) {
		if (flag)
			rep (j , 1 , m) {
				rep (i , 1 , n) putchar(ch(a[i][j]));
				puts("");
			}
		else
			rep (i , 1 , n) {
				rep (j , 1 , m) putchar(ch(a[i][j]));
				puts("");
			}
//		gout(calc());
	} else
		puts("-1");
	puts("");
}

int main() {
	#ifndef ONLINE_JUDGE
		freopen("data.txt" , "r" , stdin);
	#endif
	rep (T , 1 , rd()) {
		input();
		solve();
	}
	return 0;
}

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for (int i = (a), i##_end_ = (b); i < i##_end_; ++i)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define mp make_pair
#define x first
#define y second
#define pb push_back
#define SZ(x) (int((x).size()))
#define ALL(x) (x).begin(), (x).end()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

typedef long long LL;

const int oo = 0x3f3f3f3f;

const int maxn = 100000;

int n, m, K;

vector<int> ret[maxn + 5];

int main()
{
#ifdef matthew99
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int T;
	scanf("%d", &T);
	while (T--)
	{
		scanf("%d%d%d", &n, &m, &K);
		if (n <= 4 && m <= 4)
		{
			bool find = 0;
			REP(i, 0, (1 << (n * m)))
			{
				bool g[3][3];
				REP(j, 0, n) REP(K, 0, m) g[j][K] = (i >> (j * m + K) & 1);
				int tot = 0;
				REP(j, 0, n - 1) REP(K, 0, m - 1)
				{
					int tmp = g[j][K] + g[j + 1][K] + g[j][K + 1] + g[j + 1][K + 1];
					if (tmp == 3) ++tot;
					else if (tmp == 4) tot += 4;
				}
				if (tot == K)
				{
					find = 1;
					REP(i, 0, n)
					{
						REP(j, 0, m)
						{
							if (g[i][j]) putchar('*');
							else putchar('.');
						}
						putchar('\n');
					}
					putchar('\n');
					break;
				}
			}
			if (!find) puts("-1\n");
			continue;
		}
		if (K > ((n - 1) * (m - 1) << 2))
		{
			puts("-1\n");
			continue;
		}
		else if (K == ((n - 1) * (m - 1) << 2))
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar('*');
				putchar('\n');
			}
			putchar('\n');
			continue;
		}
		bool rev = 0;
		if (n > m) swap(n, m), rev = 1;
		REP(i, 0, n) ret[i] = vector<int>(m, 0);
		bool failed = 0;
		if (K)
		{
			--K;
			REP(i, 0, m) ret[0][i] = 1;
			REP(i, 0, n) ret[i][0] = 1;
			int px = 0, py = m - 1;
			REP(i, 1, n) REP(j, 1, m)
			{
				if (K < 4) break;
				px = i, py = j;
				ret[i][j] = 1;
				K -= 4;
			}
			if (K == 1)
			{
				if (px != n - 1)
				{
					if (py > 1) ret[px + 1][py] = 1;
					else ret[px][m - 1] = 1;
				}
				else if (py != m - 2) ret[n - 1][m - 1] = 1;
				else failed = 1;
			}
			else if (K == 2)
			{
				if (px != n - 1)
				{
					if (py > 2) ret[px + 1][py - 1] = 1;
					else if (py == 2) ret[px + 1][py] = 1, ret[px][m - 1] = 1;
					else ret[px + 1][m - 2] = 1;
				}
				else if (py < m - 3) ret[px][py + 2] = 1;
				else failed = 1;
			}
			else if (K == 3)
			{
				if (py != m - 1)
				{
					ret[px][py + 1] = 1;
					ret[0][0] = 0;
				}
				else if (px != n - 1) ret[px + 1][1] = 1, ret[0][0] = 0;
				else failed = 1;
			}
		}
		if (rev) swap(n, m);
		if (failed)
		{
			puts("-1");
		}
		else
		{
			REP(i, 0, n)
			{
				REP(j, 0, m) putchar((rev ? ret[j][i] : ret[i][j]) ? '*' : '.');
				putchar('\n');
			}
		}
		putchar('\n');
	}
	return 0;
}

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=100005;
int xx[N],yy[N],yes[N],n,m,cnt,now,flag,x,y,X,Y,K;
vi a[N];

int calc(int x,int y){
	int res=0;
	res+=a[x-1][y-1]&a[x-1][y];
	res+=a[x-1][y-1]&a[x][y-1];
	res+=a[x-1][y]&a[x][y-1];
	res+=a[x-1][y]&a[x-1][y+1];
	return res;
}

int chk(int s){
	static int q[N];
	int l=0,r=0;
	rep(i,1,cnt){
		a[xx[i]][yy[i]]=0;
		yes[i]=0;
		if(!(s>>(i-1)&1)) continue;
		if(xx[i]==x||xx[i]==x+1&&yy[i]<=y) yes[i]=1,q[r++]=i;
	}
	while(l<r){
		int u=q[l++];
		rep(v,1,cnt)if(s>>(v-1)&1){
			if(!yes[v]&&abs(xx[u]-xx[v])+abs(yy[u]-yy[v])==1){
				yes[v]=1,q[r++]=v;
			}
		}
	}
	rep(i,1,cnt) if((s>>(i-1)&1)&&!yes[i]) return 0;
	int sum=now;
	rep(i,1,cnt) if(s>>(i-1)&1) sum+=calc(xx[i],yy[i]),a[xx[i]][yy[i]]=1;
	return sum==K;
}

void rmain(){
	read(n),read(m),read(K);
	if(n<m) swap(n,m),flag=1;
	rep(i,0,n+1) a[i].clear(),a[i].resize(m+2);
	now=0,x=n,y=m;
	int rem=n*m;
	rep(i,1,n){
		int owo=0;
		rep(j,1,m){
			int nxt=calc(i,j); rem--;
			if(now+nxt<=K&&rem>=10) now+=nxt,a[i][j]=1;
			else {x=i,y=j-1; if(y==0)y=m,x--; owo=1;break;}
		}
		if(owo) break;
	}
	cnt=0,X=x,Y=y;
	while(cnt<10){
		Y++; if(Y>m) X++,Y=1;
		if(X>n) break;
		xx[++cnt]=X,yy[cnt]=Y;
	}
	int found=0;
	for(int s=(x==0?1:0);s<(1<<cnt);s++)
		if(chk(s)){
			found=1;
			break;
		}
	if(!found){
		puts("-1");
		return;
	}
	if(flag) swap(n,m);
	rep(i,1,n){
		rep(j,1,m) printf("%c",(flag?a[j][i]:a[i][j])?'*':'.');
		puts("");
	}
}

int main(){
	int T; read(T);
	while(T--) rmain(),puts("");
	return 0;
}

#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
char __carr[550055], *__pcarr=__carr;
inline char* newchar(const unsigned int SZ) {
	__pcarr += SZ;
	return __pcarr - SZ;
}
inline void initchar() { __pcarr=__carr; }
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

char DB[5][5][37][4][4];

char *A[100005];
bool chk[10][10];

int T, H, W, N;

int countStars(int H, int W) {
	int ret = 0;
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++) {
		if('*' != A[i][j]) continue;
		if('*' == A[i+1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i+1][j] && '*' == A[i][j-1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j+1]) ret++;
		if('*' == A[i-1][j] && '*' == A[i][j-1]) ret++;
	}
	return ret;
}

void dfs(int y, int x) {
	chk[y][x] = true;
	for(int dr = 0; dr < 4; dr++) {
		int ny = y+dy[dr], nx = x+dx[dr];
		if('*' != A[ny][nx] || chk[ny][nx]) continue;
		dfs(ny, nx);
	}
}
bool isConnected(int H, int W) {
	for(int i = 0; i <= H+1; i++)
		fill(chk[i], chk[i]+W+2, false);

	bool flag = false;
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++) {
			if('*' == A[i][j]) {
				flag = true;
				dfs(i, j);
				break;
			}
		}
		if(flag) break;
	}

	if(!flag) return false;

	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('*' == A[i][j] && !chk[i][j]) return false;
	return true;
}

void printAnswer(int H, int W) {
	for(int i = 1; i <= H; i++) {
		for(int j = 1; j <= W; j++)
			putchar(A[i][j]);
		puts("");
	}
}

int main() {
	for(int i = 0; i < 10; i++)
		A[i] = newchar(10);
	for(int h = 3; h <= 4; h++) for(int w = 3; w <= 4; w++) {
		for(int key = 0; key < (1<<(w*h)); key++) {
			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				A[i+1][j+1] = (key & (1<<(i*w+j))) ? '*' : '.';
			int cnt = countStars(h, w);
			if(!isConnected(h, w)) continue;

			for(int i = 0; i < h; i++) for(int j = 0; j < w; j++)
				DB[h][w][cnt][i][j] = A[i+1][j+1];
		}
	}

	scanf("%d", &T);
	for(int ti = 0; ti < T; ti++) {
		if(ti) puts("");
		scanf("%d%d%d", &H, &W, &N);
		if(H <= 4 && W <= 4) {
			if(!DB[H][W][N][0][0]) {
				puts("-1");
				continue;
			}
			for(int i = 0; i < H; i++) {
				for(int j = 0; j < W; j++) {
					putchar(DB[H][W][N][i][j]);
				}
				puts("");
			}
			continue;
		}

		if((H-1) * (W-2) * 4 == N) {
			for(int i = 1; i <= H; i++) {
				for(int j = 1; j < W; j++)
					putchar('*');
				puts(".");
			}
			continue;
		}

		if((H-2) * (W-1) * 4 == N) {
			for(int i = 1; i < H; i++) {
				for(int j = 1; j <= W; j++)
					putchar('*');
				puts("");
			}
			for(int j = 1; j <= W; j++)
				putchar('.');
			puts("");
			continue;
		}

		initchar();
		for(int i = 0; i <= H+1; i++) {
			A[i] = newchar(W+2);
			fill(A[i], A[i]+W+2, '.');
		}

		bool flag = false;
		int cnt = 0;
		for(int i = 1; i <= W; i++) A[1][i] = '*';
		for(int i = 2; i <= H; i++) {
			for(int j = 1; j <= W; j++) {
				int ll = i < H ? min(4, W) : 0;
				for(int nkey = 0; nkey < (1<<ll); nkey++) {
					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = (nkey & (1<<k)) ? '*' : '.';

					int l = min(4, W-j+1);
					for(int key = 0; key < (1<<l); key++) {
						int sum = cnt, nsum = 0;
						bool iscon = true, niscon = true;

						for(int k = 0; k < l; k++)
							A[i][j+k] = (key & (1<<k)) ? '*' : '.';
						for(int k = 0; k < l; k++) if(key & (1<<k)) {
							if('*' == A[i-1][j+k]) {
								if('*' == A[i-1][j+k-1]) sum++;
								if('*' == A[i][j+k-1]) sum++;
								if('*' == A[i-1][j+k+1]) sum++;
							}
							if('*' == A[i][j+k-1] && '*' == A[i-1][j+k-1]) sum++;
							if('*' != A[i-1][j+k] && '*' != A[i][j+k-1]) iscon = false;
						}

						for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
							if('*' == A[i][k+1]) {
								if('*' == A[i][k]) nsum++;
								if('*' == A[i+1][k]) nsum++;
								if('*' == A[i][k+2]) nsum++;
							}
							if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
							if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
						}

						if(sum+nsum == N && iscon && niscon) {
							flag = true;
							printAnswer(H, W);
							break;
						}
						nsum = 0; niscon = true;

						if('*' != A[i][W]) {
							A[i][W] = '*';
							if('*' == A[i-1][W]) {
								if('*' == A[i-1][W-1]) sum++;
								if('*' == A[i][W-1]) sum++;
							}
							if('*' == A[i][W-1] && '*' == A[i-1][W-1]) sum++;
							if('*' != A[i-1][W] && '*' != A[i][W-1]) iscon = false;

							for(int k = 0; k < ll; k++) if(nkey & (1<<k)) {
								if('*' == A[i][k+1]) {
									if('*' == A[i][k]) nsum++;
									if('*' == A[i+1][k]) nsum++;
									if('*' == A[i][k+2]) nsum++;
								}
								if('*' == A[i+1][k] && '*' == A[i][k]) nsum++;
								if('*' != A[i][k+1] && '*' != A[i+1][k]) niscon = false;
							}

							if(sum+nsum == N && iscon && niscon) {
								flag = true;
								printAnswer(H, W);
								break;
							}
						}

						for(int k = 0; k < l; k++)
							A[i][j+k] = '.';
						A[i][W] = '.';
					}

					for(int k = 0; k < ll; k++)
						A[i+1][k+1] = '.';

					if(flag) break;
				}
				if(flag) break;

				A[i][j] = '*';
				if(1 == j) cnt++;
				else if(j == W) cnt += 3;
				else cnt += 4;
			}
			if(flag) break;
		}

		if(!flag) {
			puts("-1");
			continue;
		}
	}

	return 0;
}

#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#define pb push_back
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.pb(i):em.pb(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.pb(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.pb(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;
}