#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

int add(int n)
{
	int ret = 0;
	while (n){
		ret += (n % 10);
		n /= 10;
	}
	return ret;
}

int main(void)
{
	int a, b, number = 1;
	while (scanf("%d %d", &a, &b) != EOF){
		int n, m, now = 0;
		n = min(a, b);
		m = max(a, b);
		vector <int> ret, tmp;
		for (int num = n; num <= m; num++){
			int start = num;
			tmp.clear();
			tmp.push_back(start);
			while (start != 15){
				now = 0;
				for (int i = 1; i*i <= start; i++){
					if (start % i == 0){
						now += add(i);
						if (i != start / i){
							now += add(start / i);
						}
					}
				}
				tmp.push_back(now);
				start = now;
			}
			if (tmp.size() > ret.size()){
				ret = tmp;
			}
		}
		cout << "Input" << number << ": " << a << " " << b << endl;
		cout << "Output" << number << ": ";
		for (int i = 0; i < ret.size(); i++){
			cout << ret[i] << (i+1 == ret.size() ? "\n": " ");
		}
		number++;
	}

	return 0;
}