#include<iostream>
using namespace std;

string s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
void Print(int n,int base)
{
	if(n>=base)Print(n/base,base);
	cout<<s[n%base];
}

void solve() /* Define function solve() to process one case of the problem    */
{
	int n;
	cin>>n;
	Print(n,2);
	cout<<' ';
	Print(n,16);
	cout<<endl;


}


/******************************************************************************/
/*                                                                            */
/*  DON'T MODIFY main() function anyway!                                      */
/*                                                                            */
/******************************************************************************/

#include <stdio.h>

void solve(); /* write function solve() to process one case of the problem    */

int main()
{  int i,t; scanf("%d",&t);
   for (i=0;i<t;i++)
   { printf("case #%d:\n",i);
     solve();
   }
   return 0;
}
