#include using namespace std; template void chmin(T&x,const T &y) { if(x>y)x=y; } template void chmax(T &x,const T &y) { if(x pii; #define rep(i,l,r) for(int i=l;i<=r;++i) #define per(i,r,l) for(int i=r;i>=l;--i) #define rep0(i,l,r) for(int i=l;i='0')x=x*10+c-'0'; return -x; } int x=c-'0'; while(gc>='0')x=x*10+c-'0'; return x; } #undef gc const int N=10000+5,L=250,D=1e9+7; int n,p[N]; s64 c[N][L]; void add(s64 c1[],s64 c2[]) { chmax(c1[0],c2[0]); rep(i,1,c2[0])c1[i]+=c2[i]; } void qiu(int i) { for(;i;i-=i&-i)add(c[0],c[i]); } void add(int i) { for(;i<=n;i+=i&-i)add(c[i],c[0]); } int main() { #ifdef kcz freopen("1.in","r",stdin);freopen("1.out","w",stdout); #endif int tt; cin>>tt; rep(case_id,1,tt) { n=read(); rep(i,1,n)p[i]=read(); rep(i,1,n) rep(j,0,L-1)c[i][j]=0; rep(i,1,n) { rep(j,0,L-1)c[0][j]=0; qiu(p[i]); ++c[0][0]; per(j,c[0][0],2)c[0][j]=c[0][j-1]%D; c[0][1]=1; add(p[i]); } rep(j,0,L-1)c[0][j]=0; qiu(n); printf("Case #%d:",case_id); rep(i,1,c[0][0])printf(" %d",int(c[0][i]%D)); rep(i,c[0][0]+1,n)printf(" 0"); puts(""); } }