double f;b,x;main(long a){for(gets(&f);x=~scanf("%ld%d",&a,&b);printf("%d %d %ld\n",x/10,(x=pow(10,f-a+1))%10,a=f=log10(a)*b));}