#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define rep(i,j,k) for(int i=(j);i<=(k);i++)
#define per(i,j,k) for(int i=(j);i>=(k);i--)
int rd(){
	int x=0;char ch=getchar();
	while(!isdigit(ch))ch=getchar();
	while(isdigit(ch))x=x*10+(ch-'0'),ch=getchar();
	return x;
}
void wr(int x,char ch='\n'){
	int sta[45],top=0;
	do sta[++top]=x%10,x/=10;while(x);
	for(int i=top;i;i--)putchar(sta[i]+'0');
	putchar(ch);
}
const int p=998244353;
int ksm(int a,int b){
  int ans=1;
  for(;b;b>>=1,a=1ll*a*a%p)
  if(b&1)ans=1ll*a*ans%p;
  return ans;
}
long long f[1000010];
int g[1000010];
void solve(){
  int a=rd(),b=rd(),c=rd();
  cout<<f[a]<<" "<<g[a]<<endl;
}
signed main(){
  freopen("geometry.in","r",stdin);
  freoprn("geometry.out","w",stdout);
  f[1]=3,g[1]=2;
  f[2]=12,g[2]=5;
  rep(i,3,1000000){
    f[i]=f[i-1]+3ll*(2*i-1);
    g[i]=g[i-1]*2%p;
  }
  int T=rd();
  while(T--)solve();
}
