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

int main (void){

  double min,taikaku,i,t,r;
  int h,w,minh,minw;
    for(;;){
    scanf("%d %d",&h,&w);
    if(h==0&&w==0)break;
    min = 150*sqrt(2.0);
  for(i=150;i>0;i--){
    for(t=150;t>0;t--){
      if(i == t){
	taikaku = 500;
      }else{
	r = i*i+t*t;
	if(sqrt(r)<=sqrt(h*h+w*w)){
	  taikaku = 500;
	}else{
	  taikaku = sqrt(r);
	}      
}
      if(min>taikaku){
	min = taikaku;
	minh = i;
	minw = t;
      }else{
	;
      }
      
    }
  }
  printf("%d %d\n",minw,minh);
      
    }
    return 0;
}