#include <iostream>

using namespace std;

int main()
{

    int n,m,a;
    
    while(cin >> n >> m,n!=0&&m!=0){
        a = m-n;
        cout << a%500/100 << " " << a%1000/500 << " " << a/1000 << endl; 
    }
    
    return 0;
}

