#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


struct Info{
	char buf[8];
	int value;
};
Info info[20];

void strcpy(char* to,char* str){
	for(int i=0;str[i] != '\0';i++){
		to[i] = str[i];
		to[i+1] = '\0';
	}
}

bool strCmp(char* base, char* comp){
	int length1,length2;
	for(length1=0;base[length1] != '\0';length1++);
	for(length2=0;comp[length2] != '\0';length2++);
	if(length1 != length2)return false;

	for(int i=0;base[i] != '\0'; i++){
		if(base[i] != comp[i])return false;
	}
	return true;
}

char number[1050],prefix[51],unit[51];


void func(){

	int num_digit,num_pow;
	bool not_0_FLG,period_FLG;

	scanf("%s",number);

	if(number[0] == '0'){
		num_digit = 0;
		num_pow = 0;
		not_0_FLG = false;

		for(int i = 2; number[i] != '\0'; i++){

			if(not_0_FLG == false){
				num_pow -= 1;
				if(number[i] != '0'){
					not_0_FLG = true;
					num_digit++;
				}
			}else{
				num_digit++;
			}
		}
	}else{
		num_digit = 0;
		num_pow = -1;
		period_FLG = false;

		for(int i = 0; number[i] != '\0'; i++){

			if(number[i] != '.')num_digit++;

			if(period_FLG == false && number[i] == '.'){
				period_FLG = true;
			}else if(period_FLG == false){
				num_pow++;
			}
		}
	}

	scanf("%s",prefix);

	int prefix_value = 0;
	for(int i = 0; i < 20; i++){
		if(strCmp(info[i].buf,prefix)){
			prefix_value = info[i].value;
			break;
		}
	}

	if(prefix_value == 0){
		strcpy(unit,prefix);
	}else{
		scanf("%s",unit);
	}

	num_pow += prefix_value;

	int index = 0,output_digit = 0;

	while(true){
		if(number[index] == '0'){
			index++;
		}else if(number[index] == '.'){
			index++;
		}else{
			break;
		}
	}
	printf("%c",number[index++]);
	output_digit = 1;
	if(num_digit > 1){
		printf(".");
		for(;number[index] != '\0';index++){
			if(number[index] != '.'){
				printf("%c",number[index]);
				output_digit++;
			}
		}
	}
	if(output_digit < num_digit){
		for(int i = 1; output_digit+i != num_digit; i++)printf("0");
	}


	printf(" * 10^%d %s\n",num_pow,unit);
}

int main(){

	info[0].value = 24;
	strcpy(info[0].buf,"yotta");

	info[1].value = 21;
	strcpy(info[1].buf,"zetta");

	info[2].value = 18;
	strcpy(info[2].buf,"exa");

	info[3].value = 15;
	strcpy(info[3].buf,"peta");

	info[4].value = 12;
	strcpy(info[4].buf,"tera");

	info[5].value = 9;
	strcpy(info[5].buf,"giga");

	info[6].value = 6;
	strcpy(info[6].buf,"mega");

	info[7].value = 3;
	strcpy(info[7].buf,"kilo");

	info[8].value = 2;
	strcpy(info[8].buf,"hecto");

	info[9].value = 1;
	strcpy(info[9].buf,"deca");

	info[10].value = -1;
	strcpy(info[10].buf,"deci");

	info[11].value = -2;
	strcpy(info[11].buf,"centi");

	info[12].value = -3;
	strcpy(info[12].buf,"milli");

	info[13].value = -6;
	strcpy(info[13].buf,"micro");

	info[14].value = -9;
	strcpy(info[14].buf,"nano");

	info[15].value = -12;
	strcpy(info[15].buf,"pico");

	info[16].value = -15;
	strcpy(info[16].buf,"femto");

	info[17].value = -18;
	strcpy(info[17].buf,"ato");

	info[18].value = -21;
	strcpy(info[18].buf,"zepto");

	info[19].value = -24;
	strcpy(info[19].buf,"yocto");


	int case_num;
	scanf("%d",&case_num);

	for(int i = 0; i < case_num; i++)func();

	return 0;
}