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

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

	for ( ; scanf( "%d %d", &h, &w ), h; printf( "%d %d\n", h, w ) )
		for ( d = dSq = h * h + w * w; d < 30000; d++ )
			for ( h = d == dSq ? h + 1 : 1; h * h * 2 < d; h++ ) {
				w = sqrt( d - h * h );

				if ( w * w == d - h * h ) {
					d = 30000;
					break;
				}
			}

	return 0;
}