#include<stdio.h>

int main(){

	int m,a,b,c,temp;

	while(1){
		scanf("%d %d",&c,&m);
		if(c==0&m==0){
			break;
		}
		temp=m-c;
		c=temp/1000;
		temp=temp-c*1000;
		b=temp/500;
		temp=temp-b*500;
		a=temp/100;
		printf("%d %d %d\n",a,b,c);
	}
}