#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <vector>

using namespace std;

string old, s;
long long res;
long long BASE, MOD;

long long min_mod = 1e9, max_mod = 2 * min_mod;

vector<long long> pow;

string gready(long long a)
{
	string s = "";
	int i = 0;
	long long cur_val = 0;
	while (cur_val + pow[i] <= a)
	{
		s += 'a';
		cur_val += pow[i];
		i++;	
	}
	i--;
	while (i > -1)
	{
		while (cur_val + pow[i] <= a)
		{
			if (s[i] == 'z') break;
			s[i]++;
			cur_val += pow[i];
		}		
		i--;
	}
	return s;
}

long long hash(string s)
{
	long long ans = 0;
	for (size_t i = 0; i < s.length(); i++)
		ans += (s[i] - 'a' + 1) * pow[i];
	return ans;
}

void quit(long long base, long long mod)
{
	cout << "answer: " << base << " " << mod <<"\n";
	cout.flush();
	exit(0);
}

void print(string s)
{
	cout << s << "\n";
	cout.flush();
}

pair<int, long long> count_ok(long long x)
{
	int cnt = 0;
	long long first_ok = 0;
	for (int  i = 1; x / i >= min_mod; i++)
		if (x % i == 0 && min_mod <= x / i && x / i <= max_mod)
			cnt++, first_ok = x / i;
	return make_pair(cnt, first_ok);
}

int main()
{
	cin >> s;
	print("aa");
	old = "aa";
	cin >> BASE, BASE--;
	long long cur_pow = 1;
	while (cur_pow < 2e15)
	{
		pow.push_back(cur_pow);
		cur_pow *= BASE;	
	}
	for (int i = 1; i < 11; i++) {
		s = gready(i * max_mod - 1);
		while (s == old) i++, s = gready(i * max_mod - 1);
		print(s);
		old = s;
		long long hh = hash(s);
		cin >> res;
		min_mod = max(min_mod, res + 1);
		if (res < hh && count_ok(hh - res).first == 1)
			quit(BASE, count_ok(hh - res).second);
	}
}


