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

#define MAX 100

int main(){

	int h,w;
	int i,j;
	int s_buffer;
	int s_answer;
	int h_answer;
	int w_answer;


	while(1){

		s_answer = MAX*MAX+MAX*MAX;

		scanf("%d %d",&h,&w);

		if(h == 0 && w == 0){
			break;
		}

		s_buffer = h*h+w*w;

		for(i=1;i<=MAX;i++){
			for(j=i+1;j<=MAX;j++){

				if(s_buffer < i*i+j*j && i*i+j*j <= s_answer && i > h){

					s_answer = i*i+j*j;
					h_answer = i;
					w_answer = j;
				}
			}
		}
		printf("%d %d\n",h_answer,w_answer);
	}
}