#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
int main()
{
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	int t;
	scanf("%d",&t);
	while(t)
	{
		--t;
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		long long ans1=4,ans2=a;
		for(int i=1;i<=a;i++) ans1=ans1*3,ans2=(ans2*ans2-ans1)%mod;
		printf("%lld %lld\n",ans1,ans2);
	}
	return 0;
}
