> File Name: 5829.cpp
> Author: jiangyuzhu
> Mail: 834138558@qq.com
> Created Time: 2016/8/24 8:43:01
************************************************************************/
#include<iostream>
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
const int maxn = 1e5 + 5, mod = 998244353, g = 3;
int n;
typedef long long ll;
ll A[maxn << 2], B[maxn << 2];
ll a[maxn];
ll Pow(ll a, ll n)
{
ll ret = 1;
for(; n; n >>= 1, a = a * a % mod){
if(n & 1) ret = ret * a % mod;
}
return ret;
}
void NTT(ll y[], int len, int op)
{
for(int i = 1, j = len / 2; i < len - 1; i++) {
if(i < j) swap(y[i], y[j]);
int k = len / 2;
while(j >= k) {
j -= k;
k /= 2;
}
if(j < k) j += k;
}
for(int h = 2; h <= len; h <<= 1) {
ll wn = Pow(g, (mod - 1) / h);
if(op == -1) wn = Pow(wn, mod - 2);
for(int j = 0; j < len; j += h) {
ll w = 1;
for(int k = j; k < j + h / 2; k++) {
ll u = y[k];
ll t = w * y[k + h / 2] % mod;
y[k] = (u + t) % mod;
y[k+h/2] = (u - t + mod) % mod;
w = w * wn % mod;
}
}
}
if(op == -1) {
ll t = Pow(len, mod - 2);
for(int i = 0; i < len; i++)
y[i] = y[i] * t % mod;
}
}
ll inv[maxn], two[maxn], fact[maxn];
void init()
{
two[0] = 1;inv[0] = 1;fact[0] = 1;
for(int i = 1; i < maxn; i++){
inv[i] = inv[i - 1] * Pow(i, mod - 2) % mod;
fact[i] = fact[i - 1] * i % mod;
two[i] = two[i - 1] * 2 % mod;
}
}
int main()
{
init();
int T;scanf("%d", &T);
while(T--){
memset(A, 0, sizeof(A));
memset(B, 0, sizeof(B));
int n;scanf("%d", &n);
int x;
for(int i = 0; i < n; i++){
scanf("%I64d", &a[i]);
}
sort(a, a + n, greater<int>());
for(int i = 0; i < n; i++)cout<<a[i]<<' ';
cout<<endl;
for(int i = 0; i < n; i++){
A[i] = two[n - i] * inv[i] % mod;
B[n - 1 - i] = fact[i] * a[i] % mod;
}
int k;
int l = 2 * n;
for(k = 1; k < l; k <<= 1);
l = k;
NTT(A, l, 1), NTT(B, l, 1);
for(int i = 0; i < l; i ++){
A[i] = A[i] * B[i] % mod;
}
NTT(A, l, -1);
ll ans = 0;
ll invtot = 1;
ll invtwo = Pow(2, mod - 2);
for(int i = 1; i <= n; i++){
invtot = invtot * invtwo % mod;
(ans += inv[i - 1] * A[n - i] % mod * invtot % mod) %= mod;
printf("%I64d ", ans);
}
puts("");
}
return 0;
}