#include <iostream>
#include <string>
using namespace std;
int main(void)
{
int t;
cin >> t;
for(int pk = 1; pk <= t; pk++)
{
double n;
string unit;
cin >> n >> unit;
if (unit == "kg")
{
n *= 2.2046;
unit = "lb";
}
else if (unit == "l")
{
n *= 0.2642;
unit = "g";
}
else if (unit == "lb")
{
n *= 0.4536;
unit = "kg";
}
else if (unit == "g")
{
n *= 3.7854;
unit = "l";
}
cout << fixed; //소수점이하 수 출력
cout.precision(4); //4자리까지
cout << pk << " " << n << " " << unit << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4odm9pZCkKewoJaW50IHQ7CgljaW4gPj4gdDsKCglmb3IoaW50IHBrID0gMTsgcGsgPD0gdDsgcGsrKykKCXsKCQlkb3VibGUgbjsKCQlzdHJpbmcgdW5pdDsKCQljaW4gPj4gbiA+PiB1bml0OwoKCQlpZiAodW5pdCA9PSAia2ciKQoJCXsKCQkJbiAqPSAyLjIwNDY7CgkJCXVuaXQgPSAibGIiOwoJCX0KCQllbHNlIGlmICh1bml0ID09ICJsIikKCQl7CgkJCW4gKj0gMC4yNjQyOwoJCQl1bml0ID0gImciOwoJCX0KCQllbHNlIGlmICh1bml0ID09ICJsYiIpCgkJewoJCQluICo9IDAuNDUzNjsKCQkJdW5pdCA9ICJrZyI7CgkJfQoJCWVsc2UgaWYgKHVuaXQgPT0gImciKQoJCXsKCQkJbiAqPSAzLjc4NTQ7CgkJCXVuaXQgPSAibCI7CgkJfQoJCWNvdXQgPDwgZml4ZWQ7CQkJLy/shozsiJjsoJDsnbTtlZgg7IiYIOy2nOugpQoJCWNvdXQucHJlY2lzaW9uKDQpOwkJLy807J6Q66as6rmM7KeACgkJY291dCA8PCBwayA8PCAiICIgPDwgbiA8PCAiICIgPDwgdW5pdCA8PCBlbmRsOwoJfQp9