#include<bits/stdc++.h>
using namespace std;
#define ll long long
int digits(ll n)
{
    int count=0;
    while(n>0)
    {
        count++;
        n/=10;
    }
    return count;
}
int main()
    {
    ll t;
    cin>>t;
    while(t--)
    {
        ll a,b,c;
        cin>>a>>b>>c;
        ll parr[10] = {1 , 3, 13 , 101 , 1009 , 10007 , 100001 ,1000003, 10000019, 100030001};
        ll c1 = parr[c];
        ll x = ((ll)pow(10 , a-c))*c1;
        ll y =c1;
        while(digits(y)!=b)
        {
            y*=11;
        }
        cout<<x<<" "<<y<<endl;
    }
}