#include #include #include #define fo(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--) using namespace std; typedef long long ll; const int N=1e3+5,Mo=998244353; int ty,n,a[N],C[N][N],f[N][2],g[N][2],fac[N]; int main() { fo(i,0,1e3) { C[i][0]=1; fo(j,1,i) C[i][j]=(C[i-1][j]+C[i-1][j-1])%Mo; } fac[0]=1;fo(i,1,1e3) fac[i]=(ll)fac[i-1]*i%Mo; for(scanf("%d",&ty);ty;ty--) { scanf("%d",&n); fo(i,1,n) scanf("%d",&a[i]); sort(a+1,a+n+1);int sum=0,ret=1; fo(i,0,n) f[i][0]=f[i][1]=0; for(int l=1,r=0;l<=n;l=r+1) { while (r