#include<bits/stdc++.h>
using namespace std;
int T,a,b,c,ans[5]={0,3,12,27,48},sum[5]={0,2,20,980,236180};

int main()
{
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	scanf("%d",&T);
	while (T--)
	{
		scanf("%d%d%d",&a,&b,&c);
		a=min(5,a);
		printf("%d %d\n",ans[a],sum[a]);
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
