#include <stdio.h>
#include <math.h>

int main( void ) {
	int h, w, dSq, hh, ww, d;

	for ( ; scanf( "%d %d", &h, &w ), h; printf( "%d %d\n", hh, ww ) ) {
		dSq = h * h + w * w;

		for ( hh = h + 1; hh * hh * 2 < dSq; hh++ ) {
			ww = sqrt( dSq - hh * hh );

			if ( hh * hh + ww * ww == dSq )
				goto contin;
		}

		for ( d = dSq + 1; ; d++ )
			for ( hh = 1; hh * hh * 2 < d; hh++ ) {
				ww = sqrt( d - hh * hh );

				if ( hh * hh + ww * ww == d )
					goto contin;
			}

		contin: ;
	}

	return 0;
}