#include <stdio.h>

int tai(int x,int y){
		x = x*x+y*y;
		return x;
	}

int main(){
	int h,w,h1,w1;
	while(1){
		int ha=151,wa=151;
		scanf("%d %D",&h1,&w1);
		if((h1==0)&&(w1==0)){
			return 0;
		}

		for(h=1;h<150;h++){
			for(w=h+1;w<=150;w++){
				if((tai(w,h) > tai(w1,h1)) && ((tai(h,w) < tai(ha,wa)))  ||  (tai(w,h) > tai(w1,h1)) && (tai(h,w) == tai(ha,wa)) && (h < ha) || (tai(w,h) > tai(w1,h1)) &&(tai(w,h) == tai(w1,h1))&&(h>h1)){
					ha = h;
					wa = w;
				}
				

			}
		}
		printf("%d %d\n",ha,wa);

	}
	return 0;
}