#include #include #include using namespace std; const int M=10010; const int mod=1000000007; int cas,n,i,j,a[M],ans[M],tree[210][M]; int query(int id,int x){ int ans=0; for (int i=x;i;i-=i&(-i))ans=(ans+tree[id][i])%mod; return ans; } void update(int id,int x,int w){ for (int i=x;i<=n;i+=i&(-i))tree[id][i]=(tree[id][i]+w)%mod; } int main(){ scanf("%d",&cas); for (int Cas=1;Cas<=cas;Cas++){ scanf("%d",&n); for (i=1;i<=n;i++)scanf("%d",&a[i]); printf("Case #%d:",Cas); memset(tree,0,sizeof tree); memset(ans,0,sizeof ans); update(0,1,1); for (i=1;i<=n;i++){ for (j=min(i,200);j;j--){ int tmp=query(j-1,a[i]); ans[j]=(ans[j]+tmp)%mod; update(j,a[i],tmp); } } for (i=1;i<=n;i++)printf(" %d",ans[i]);puts(""); } }