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

int main() {
  
    int t;
    cin>>t;
    
    int arra[10] = { 0,
                    3,
                    17,
                    151,
                    1117,
                    11941,
                    117653,
                    1219837,
                    12176537,
                    132176537
    };
    
    int arrb[10] = {0,
                    7,
                    23,
                    191,
                    1181,
                    12071,
                    129837,
                    1329837,
                    13298373,
                    143298373
    };
    
    
    while(t--)
    {
        int a, b, c, x=0, y=0, z = 0;
        cin>>a>>b>>c;
        
            if(a==c || b == c)
            {
                x = pow(10, a- 1);
                y = pow(10, b- 1);
            }
            else
            {
                z = arra[c];
                x = z * arra[a- c+ 1];
                y = z * arrb[b- c+ 1];
            }
            
            
            cout<<x<<" "<<y<<endl;
    }
    
    
    
	
	return 0;
}
