fun main(args:Array<String>):Unit {
    repeat(readLine()!!.trim().toInt()){
        val str = readLine()!!.trim().split(' ')
        val (shift, kasuu) = str.first().shiftWhileZero()
        if (str.size == 2){
            println("$kasuu * 10^${-shift} ${str.last()}")
        }else{
            val e = prefixToExpoent(str[1])
            println("${kasuu} * 10^${e-shift} ${str.last()}")
        }
    }
}
fun String.shiftWhileZero():Pair<Int, String> {
    val shift = this.indexOf('.')
    return when(shift){
        -1 -> Pair(-this.length + 1, this[0] + "." + this.substring(1))
        else -> {
            val removed = this.filterNot{it == '.'}.dropWhile { it == '0' }
            val fromRight = this.length - shift
            if (removed.length != 1) Pair(fromRight - removed.length, removed[0] + "." + removed.substring(1))
            else Pair(fromRight - removed.length, removed)
        }
    }

}
fun prefixToExpoent(prefix:String):Int {
    val map = mapOf(
            Pair("yotta", 24),
            Pair("zetta", 21),
            Pair("exa", 18),
            Pair("peta", 15),
            Pair("tera", 12),
            Pair("giga", 9),
            Pair("mega", 6),
            Pair("kilo", 3),
            Pair("hecto", 2),
            Pair("deca", 1),
            Pair("deci", -1),
            Pair("centi", -2),
            Pair("milli", -3),
            Pair("micro", -6),
            Pair("nano", -9),
            Pair("pico", -12),
            Pair("femto", -15),
            Pair("ato", -18),
            Pair("zepto", -21),
            Pair("yocto", -24)
            )
    return map[prefix]!!
}
