#include <bits/stdc++.h>


using namespace std;

#define all(x) x.begin(),x.end()
#define ld long double
#define int long long

int get_len(int x) {
    int res = 0;
    while (x != 0) {
        res++;
        x /= 10;
    }
    return res;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int a, b, c;
        cin >> a >> b >> c;
        --c;
        int r = 1;
        while (c--)r *= 10;

        while (r % 2 == 0 || r % 3 == 0)++r;

        int a1 = r;
        while(get_len(a1) != a)a1 *= 2;
        int b1 = r;
        while(get_len(b1) != b)b1 *= 3;
        cout << a1 << " " << b1 << '\n';
    }
}