#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	int A,B;
	while(cin>>A>>B,A||B){
		int sum =abs(A-B);
		int coin[3]={0};
		if(sum/1000){
			coin[2]=(sum/1000);
			sum-=(sum/1000)*1000;
		}
		if(sum/500){
			coin[1]=(sum/500);
			sum -=(sum/500)*500;
		}
		if(sum/100){
			coin[0]=(sum/100);
			sum-=(sum/100)*100;
		}
		cout <<coin[0]<<" "<<coin[1]<<" "<<coin[2]<<endl;
	}
	return 0;
}