#include <iostream>
using namespace std;

void solve(){
	int v,m;
	while(cin >> v >> m, (v!=0 && m!=0) ){
		int change = m-v;
		
		int th = change/1000;
		change -= th*1000;

		int fifh = change/500;
		change -= fifh*500;

		int ah = change/100;
		
		cout << ah << " " << fifh << " " << th << endl;
	}
	return;
}

int main(void){
	solve();
	int i; cin >> i;
	return 0;
}