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

//square1??¨square2?????????
//sq1>sq2?????¨???1???sq<sq2?????¨???-1???sq1=sq2?????¨???0
int sqcmp(int h1,int w1,int h2,int w2){
    double l1=h1*h1+w1*w1, l2=h2*h2+w2*w2;
    if(l1!=l2){
        if(l1>l2) return 1;
        else if(l1<l2) return -1;
        else return 0;
    }else{
        if(h1>h2) return 1;
        else if(h1<h2) return -1;
        else return 0;
    }
}

int main(void){
    int i,j,h,w,ah,aw;
    for(;;){
        ah=200; aw=200;
        scanf("%d %d", &h, &w);
        if(h==0 && w==0) break;
        for(i=1;i<=150;i++){
            for(j=i+1;j<=150;j++){
                // printf("%d\n", sqcmp(ah,aw,i,j));
                if(sqcmp(i,j,h,w)==1){ //(i,j) > (h,w)
                    if(sqcmp(ah,aw,i,j)==1){ //(ah,aw) > (i,j)
                        //?§£??????????£??????´??°
                        ah=i;
                        aw=j;
                    }
                    break;
                }
            }
        }
        printf("%d %d\n", ah, aw);
        // printf("sqcmp(1,3,1,2): %d\n", sqcmp(1,3,1,2));
        // printf("sqcmp(200,200,1,3): %d\n", sqcmp(200,200,1,3));
        // printf("--------\n");
    }
    return 0;
}