#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read()
{
	int sum = 0, nega = 1; char ch = getchar();
	while(ch > '9' || ch < '0') {if(ch == '-') nega = -1; ch = getchar();}
	while(ch <= '9' && ch >= '0') sum = sum * 10 + ch - '0', ch = getchar();
	return sum * nega;
}
const int N = 2e6 + 9, mod = 998244353;
int T, a, b, c, ans;
inline void solve()
{
	a = read(), b = read(), c = read();
	ans = 0;
	for (int i = 3; i <= 3 + (a - 1) * 6; i += 6) ans += i;
	printf("%lld ", ans);
	ans = 2;
	for (int i = 1; i < a; i++) ans = (ans * 2 + 1) % mod;
	printf("%lld\n", ans);
	return ;
}
signed main()
{
	freopen("geometry.in", "r", stdin);
	freopen("geometry.out", "w", stdout);
	T = read();
	for (int ttt = 1; ttt <= T; ttt++) solve();
	return 0;
}
