#include<stdio.h>

int main(void)
{
    int h , f , m ;
    int A , B ;

    while(scanf("%d%d",&A,&B) && A != 0 && B != 0){
        A = B - A ;
        m = A / 1000 ;
        A %= 1000 ;
        f = A / 500 ;
        A %= 500 ;
        h = A / 100 ;
        printf("%d %d %d\n",h,f,m);
    }
    return 0 ;
}