//Relive your past life. //Face your demons. //The past is never dead,it is not even past. //The memories are not only the key to the past but...also to the future. //coded in Rusty Lake #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define ll long long #define pb push_back #define mp make_pair #define orz 1000000007 using namespace std; int T,n; void upd(int &x,int y){x+=y;if(x>=orz)x-=orz;} struct t{ int t[10005]; void clr(){memset(t,0,sizeof(t));} void add(int x,int y){while(x<=n)upd(t[x],y),x+=(x&-x);} int sum(int x){int ans=0;while(x)upd(ans,t[x]),x-=(x&-x);return ans;} }t[205]; int main(){ scanf("%d",&T); for(int _=1;_<=T;++_){ printf("Case #%d:",_); scanf("%d",&n); int k=min(200,n); for(int i=1;i<=k;++i)t[i].clr(); for(int i=1;i<=n;++i){ int x; scanf("%d",&x); for(int j=k;j;--j)t[j].add(x,t[j-1].sum(x-1)); t[1].add(x,1); } for(int i=1;i<=k;++i)printf(" %d",t[i].sum(n)); for(int i=k+1;i<=n;++i)printf(" 0"); printf("\n"); } //system("pause"); return 0; }