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

int main(){
    vector<int> vect;
    vect.push_back(3);
    vect.push_back(11);
    vect.push_back(101);
    vect.push_back(1009);
    vect.push_back(10007);
    vect.push_back(100003);
    vect.push_back(1000003);
    vect.push_back(10000019);
    vect.push_back(100030001);
    int t;
    cin>>t;
    int x=0,y=0;
    while(t--){
        int a,b,c;
        cin>>a>>b>>c;
        int ans=vect[c-1];
        // cout<<ans;
        int d=0;
        while(true){
            int temp=ans;
            // int d=0;
            while(temp>0){
                temp=temp/10;
                d++;
            }
            if(d==a){
                x=ans;
                break;
            }
            ans=ans*2;
            d=0;

        }
        
        ans=vect[c-1];
        d=0;
        while(true){
            int temp=ans;
            // int d=0;
            while(temp>0){
                temp=temp/10;
                d++;
            }
            if(d==b){
                y=ans;
                break;
            }
            ans=ans*3;
            d=0;

        }

        cout<<x<<" "<<y<<endl;
    }
    
}