#include<iostream>
#include<string.h>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> pii;

int main()
{
  int h,w;
  int i,j;
  while(1){
    cin>>h>>w;
    if(h==0 && w==0)break;
    int len=h*h+w*w;
    int ans=0;
    for(i=h+1;i*i<len/2;i++){//i:tate
      double left=len-i*i;
      // printf("i*i=%d,left=%f,yoko=%f\n",i*i,left,sqrt(left));
      if(sqrt(left)-(int)sqrt(left)<EPS){
	ans=i; 
	break;
      }
    }
    if(ans>0){
      cout<<ans<<" "<<sqrt(len-ans*ans)<<endl;
      goto END;
    }
    while(1){
      len++;
      for(i=1;i*i<len/2;i++){
	double left=len-i*i;
	//	printf("len=%d,i*i=%d,left=%f,yoko=%f\n",len,i*i,left,sqrt(left));
	left=sqrt(left);
	if(left-(int)left<EPS){
	  cout<<i<<" "<<left<<endl;
	  goto END;
	}
      }

    }
  END:;

  }
}
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	vector<pair<int, pair<int,int>>>v;
	for (int i = 1; i <= 150; i++) {
		for (int j = i + 1; j <= 150; j++) {
			v.push_back({ i*i + j*j ,{i,j} });
		}
	}
	sort(v.begin(), v.end());
	cin >> H >> W;
	while (H) {
		bool flag = false;
		for (auto i : v) {
			if (flag) {
				cout << i.second.first << " " << i.second.second << endl;
				break;
			}
			if (i.second.first == H&&i.second.second == W) {
				flag = true;
			}
		}
		cin >> H >> W;
	}
	return 0;
}