#include <cstdlib>
#include <iostream>
#include <unordered_map>
using namespace std;

unordered_map<string, int> converter{
	{"yotta", 24},
	{"zetta", 21},
	{"exa", 18},
	{"peta", 15},
	{"tera", 12},
	{"giga", 9},
	{"mega", 6},
	{"kilo", 3},
	{"hecto", 2},
	{"deca", 1},
	{"deci", -1},
	{"centi", -2},
	{"milli", -3},
	{"micro", -6},
	{"nano", -9},
	{"pico", -12},
	{"femto", -15},
	{"ato", -18},
	{"zepto", -21},
	{"yocto", -24}};

inline string next_string() {
	string res;
	cin >> res;
	return res;
}

void solve() {
	string value = next_string(), prefix = next_string(), unit;
	int exp;
	if(converter.count(prefix)) {
		exp = converter[prefix];
		unit = next_string();
	}
	else {
		exp = 0;
		unit = prefix;
	}

	if(value[0] == '0') {
		for(unsigned i = 2; i < value.size(); ++i) {
			if('1' <= value[i] && value[i] <= '9') {
				exp -= i - 1;
				value = value[i] + string(1, '.') + value.substr(i + 1);
			}
		}
	}
	else {
		if(value.find('.') == string::npos) value += '.';
		for(unsigned i = 0; i < value.size(); ++i) {
			if(value[i] == '.') {
				exp += i - 1;
				value = value[0] + string(1, '.') + value.substr(1, i - 1) + value.substr(i + 1);
			}
		}
	}

	if(value.back() == '.') value = value.substr(0, value.size() - 1);
	cout << value << " * 10^" << exp << " " << unit << endl;
}

int main() {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int t;
	cin >> t;
	while(t--) solve();

	return EXIT_SUCCESS;
}