import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

const real eps = 1e-10;

void main(){
	while(true) {
		auto hw = readInts();
		auto h = hw[0];
		auto w = hw[1];
		if(h == 0 && w == 0) {
			return;
		}

		auto hm = 150;
		auto wm = 150;
		auto less = (int w1, int h1, int w2, int h2) {
			return w1*w1 + h1*h1 < w2*w2 + h2*h2 ||
				(w1*w1 + h1*h1 == w2*w2 + h2*h2 && h1 < h2);
		};

		for(int i = 1; i < 150; ++i) {
			for(int j = i+1; j < 150; ++j) {
				auto d2 = h*h + w*w;
				if(less(w, h, j, i) && less(j, i, wm, hm)) {
					hm = i;
					wm = j;
				}
			}
		}
		writeln(hm, " ", wm);
	}
}