#include <cstdio>
#include <algorithm>
using namespace std;

typedef struct {
	int h;
	int w;
	int D;
} RECTANGLE;

RECTANGLE rectangle[30000];

bool cmp(const RECTANGLE& A, const RECTANGLE& B)
{
	if (A.D == B.D){
		return (A.h < B.h);
	}
	return (A.D < B.D);
}

int main()
{
	int i, n;
	
	for (int w = 2, i = 0; w <= 150; w++){
		for (int h = 1; h < w; h++){
			rectangle[i].h = h;
			rectangle[i].w = w;
			rectangle[i].D = h * h + w * w;
			i++;
			n = i;
		}
	}
	
	sort(rectangle, rectangle + n, cmp);
	
	int h, w;
	while (scanf("%d %d", &h, &w), h + w){
		for (int i = 0; i < n; i++){
			if (h == rectangle[i].h && w == rectangle[i].w){
				printf("%d %d\n", rectangle[i + 1].h, rectangle[i + 1].w);
				break;
			}
		}
	}
	
	return (0);
}
#include <iostream>
#include <string>
#include <vector>


using namespace std;

int min(int a, int b) { return(a < b) ? a : b; }

class Solution
{
public:
	int minDistance(const string &word1, const string &word2)
	{
		const size_t m = word1.size() + 1;
		const size_t n = word2.size() + 1;

		vector<vector<int> > k(m, vector<int>(n));

		for (size_t i = 0; i < m; ++i)
			k[i][0] = i;

		for (size_t j = 0; j < n; ++j)
			k[0][j] = j;

		for (size_t i = 1; i < m; ++i)
		{
			for (size_t j = 1; j < n; ++j)
			{
				if (word1[i - 1] == word2[j - 1])
					k[i][j] = k[i - 1][j - 1];
				else
					k[i][j] = min(k[i - 1][j - 1], min(k[i - 1][j], k[i][j - 1])) + 1;
			}
		}
		return k[m - 1][n - 1];
	}
};

int main() {
	string a, b;
	cin >> a >> b;
	Solution A;
	cout << A.minDistance(a, b) << endl;
}