#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define _for(i,a,b) for(int i=(a) ;i<=(b) ;i++)
#define _rep(i,a,b) for(int i=(a) ;i>=(b) ;i--)
#define mst(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin() , v.end()
#define pb(v) push_back(v)
#define INF 0x3f3f3f3f
#define int long long
#define lson p*2,l,mid
#define rson p*2+1,mid+1,r
#define int long long
typedef long long ll;
int n,m,k;
ll gcd(ll a,ll b)
{
    while( b)
    {
        ll t = a;
        a = b;
        b = t%b;
    }
    return a;
}
int cal(int x)
{
    int ans=0;
    while( x )
    {
        x/=10;
        ans++;
    }
    return ans;
}
int zhuan(int x)
{
    int ans=1;
    while(x--)
    {
        ans*=10;
    }
    return ans;
}
//solve(int x ,int y)
//{
//    for(int i=zhuan(x-1);i<=zhuan(x)-1;i++)
//    {
//        for(int )
//    }
//}
int a,b,c;
signed main()
{
    //!!!!!!!!!!!!!!!!!!!!!!
//    freopen("data.txt","r",stdin);
    //!!!!!!!!!!!!!!!!!!!!!!
    int T;
    cin>>T;
    while( T-- )
    {
        cin>>n>>m>>k;
        int nn=n;
        int mm=m;
        if( n < m) swap(n,m);
        b = 3 * zhuan(m-1);
        a = 7 * zhuan(k-1);
        while( cal(a) != n) a*=7;
        if( nn != cal(a)) swap(a,b);
        cout<<a<<" "<<b<<endl;
    }
//    cout<<gcd(a,b)<<endl;
}
