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

typedef long long Int;
typedef long double Real;

const int MOD = 2004010501; //MOD > 2e9

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);

	int ten_to[10];
	ten_to[0] = 1;
	for (int i = 1; i < 10; i++) ten_to[i] = 10 * ten_to[i - 1];

	int num_tests;
	cin >> num_tests;

	for (int a, b, c; num_tests --> 0;) {
		cin >> a >> b >> c;
		int g = ten_to[c - 1];
		int tx = ten_to[a - c] + 1;
		int ty = ten_to[b - c] + 2;
		if (a == 9 and b == 3) tx++, ty--;
		Int x = (Int) tx * g, y = (Int) ty * g;
		cout << x << ' ' << y << '\n';
	}
}

