#include <stdio.h>

int main(void)
{
	int a, b, hc, fhc, tc;

	while (1) {
		scanf("%d%d", &a, &b);
		if (a == 0 && b == 0)
			break;
		tc = b - a;
		fhc = tc % 1000;
		hc = fhc % 500;
		printf("%d ", hc / 100);
		printf("%d ", fhc / 500);
		printf("%d\n", tc / 1000);
	}

	return 0;
}