#define A(x)q[(k<56?k*21+x+k)%55+h]
h=100;q[];l;main(k,n){for(gets(n);l<h;k++<atoi()+166?q[A(34:)=k<3|(A(47:)-A(13:31)+h)%h]+=k>166:printf("%d\x09%d\n",l++,q[l]));}
Note that non-ascii characters in the above source code will be escaped (such as \x9f).