#include #define Max(a,b) ((ab)&&(a=b)) #define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i) #define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i) #define erep(i,a) for(int i=hd[a],y;(y=to[i]);i=nxt[i]) using namespace std; typedef long long ll; char C; inline int rd() { int res=0,f=1; while(C=getchar(),C<48||C>57)if(C=='-')f=0; do res=(res<<3)+(res<<1)+(C^48); while(C=getchar(),C>=48&&C<=57); if(f)return res; return -res; } int cnt[15],sum[1030],dp[10][1030]; int main(){ int T=rd(); while(T--){ int n=rd(),s=0,ans=2e9; memset(cnt,0,sizeof cnt); memset(sum,0,sizeof sum); rep(i,1,n){ int t=rd(); cnt[t%10]++,s++; } int S=(1<<10)-1; rep(i,0,S)rep(j,0,9)if(1<