#include<bits/stdc++.h>

using namespace std;

long long MOD = 10e9;
long long fpow (long long base, long long ex) {
	if (ex == 0) {
		return 1LL;
	}
	long long t = fpow(base, floor(ex/2));
	if (ex % 2 == 0) {
		return (t*t)%MOD;
	}
	else {
		return ((t*t)%MOD*base)%MOD;
	}
}

int prime[9] = {7, 11, 131, 1013, 16843, 100003, 1000003, 10000019, 100000007};
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);

	int N;
	cin >> N;
	for (int i = 0; i < N; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		if (c == 1) {
			if (a < b) {
				cout << prime[a-1] << " " << fpow(10, b-1) << "\n"; 
			}
			else if (b < a) {
				cout << fpow(10, a-1) << " " << prime[b-1] << "\n"; 
			}
			else {
				cout << prime[a-1] << " " << fpow(10, a-1) << "\n";
			}
		}
		else if (a == b && b == c) {
			cout << fpow(10, a-1) << " " << fpow(10, a-1)*2 << "\n";
		}
		else if (a == c && a != b) {
			cout << fpow(10, a-1) << " " << fpow(10, b-1) << "\n";
		}
		else if (b == c && b != a) {
			cout << fpow(10, a-1) << " " << fpow(10, b-1) << "\n";
		}
		else if (a == b && b != c) {
			int x = fpow(10, a-1)+fpow(10, c-1);
			int y = (fpow(10, a-1)*2)+fpow(10, c-1);
			cout << x << " " << y << "\n";
		}
		else if (a > b && b > c) {
			int x = fpow(10, a-1)+fpow(10, c-1);
			int y = fpow(10, b-1);
			cout << x << " " << y << "\n";
		}
		else if (b > a && a > c) {
			int x = fpow(10, a-1);
			int y = fpow(10, b-1)+fpow(10, c-1);
			cout << x << " " << y << "\n";
		}
	}

    return 0;
}
