#include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <iterator>
#include <functional>
#include <ctime>
using namespace std;

const int INVALID = -1;

const vector<string> elem_names{
	"H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al",
	"Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe",
	"Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y",
	"Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb",
	"Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd",
	"Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir",
	"Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac",
	"Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No",
	"Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl",
	"Mc", "Lv", "Ts", "Og"
};

unordered_map<string, int> elem;

void spell(string const & s) {
	const int q = s.size();
	vector<int> has_repr(q + 1);
	vector<vector<int>> repr(q + 1, vector<int>(3, INVALID));
	has_repr[0] = true;
	for (int i = 0; i <= q; ++i) {
		if (!has_repr[i]) continue;
		for (int j = 1; j <= 3; ++j) {
			if (i + j > q) break;
			auto iter = elem.find(s.substr(i, j));
			if (iter != end(elem)) {
				has_repr[i + j] = true;
				repr[i + j][j - 1] = iter->second;
			}
		}
	}

	string out = s;
	function<void(int)> dfs = [&](int i) {
		if (!has_repr[i]) {
			return;
		}
		if (!i) {
			cout << out << '\n';
			return;
		}
		for (int j = 1; j <= 3; ++j) {
			int r = repr[i][j - 1];
			if (r == INVALID) continue;
			const string & name = elem_names[r];
			copy(begin(name), end(name), begin(out) + i - j);
			dfs(i - j);
		}
	};

	dfs(q);
}

int main() {
	for (int i = 0, ilen = elem_names.size(); i < ilen; ++i) {
		string s = elem_names[i];
		s[0] = tolower(s[0]);
		elem[s] = i;
	}
	
	spell("amputation");

	std::cout.setstate(std::ios_base::badbit);

	clock_t tStart = clock();

	for (int i = 0; i < 456976; ++i) {
		int ii = i;
		string s;
		for (int j = 0; j < 4; ++j) {
			s += 'a' + ii % 26;
			ii /= 26;
		}
		spell(s);
	}

	cout.clear();
	cout << double(clock() - tStart) / CLOCKS_PER_SEC << endl;
}