#include <cstdio>

typedef long long ll;
const int MOD = 998244353;
const int N = 1e6 + 10;

ll f[N], g[N];
void init() {
	for (int i = 1; i < N; ++i) {
		f[i] = f[i - 1] + (i * 2 - 1) * 3;
	}
	g[1] = 2, g[2] = 5;
	for (int i = 3; i < N; ++i) {
		g[i] = g[i - 1] * 2 % MOD;
	}
	return;
}

void solve() {
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%lld %lld\n", f[a], g[a]);
	return;
}
int main() {
	freopen("geometry.in", "r", stdin);
	freopen("geometry.out", "w", stdout);

	init();
	int T;
	scanf("%d", &T);
	while (T--) solve();
	return 0;
}