#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--;
		}
	}
}
