#include <bits/stdc++.h>
using namespace std;
bool valid(long long x)
{
while (x)
{
int d = x % 10;
if (d == 4)
return false;
x /= 10;
}
return true;
}
int main()
{
int tests;
cin >> tests;
for (int t = 1; t <= tests; t++)
{
long long N, A = 1, B;
cin >> N;
B = N - A;
while (true)
{
if (valid(A) && valid(B))
{
cout << "Case #" << t << ": " << A << " " << B << endl;
break;
}
A++, B--;
}
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpib29sIHZhbGlkKGxvbmcgbG9uZyB4KQp7Cgl3aGlsZSAoeCkKCXsKCQlpbnQgZCA9IHggJSAxMDsKCQlpZiAoZCA9PSA0KQoJCQlyZXR1cm4gZmFsc2U7CgkJeCAvPSAxMDsKCX0KCXJldHVybiB0cnVlOwp9CgppbnQgbWFpbigpCnsKCWludCB0ZXN0czsKCWNpbiA+PiB0ZXN0czsKCWZvciAoaW50IHQgPSAxOyB0IDw9IHRlc3RzOyB0KyspCgl7CgkJbG9uZyBsb25nIE4sIEEgPSAxLCBCOwoJCWNpbiA+PiBOOwoJCUIgPSBOIC0gQTsKCQl3aGlsZSAodHJ1ZSkKCQl7CgkJCWlmICh2YWxpZChBKSAmJiB2YWxpZChCKSkKCQkJewoJCQkJY291dCA8PCAiQ2FzZSAjIiA8PCB0IDw8ICI6ICIgPDwgQSA8PCAiICIgPDwgQiA8PCBlbmRsOwoJCQkJYnJlYWs7CgkJCX0KCQkJQSsrLCBCLS07CgkJfQoJfQp9Cg==