#include <iostream> #include <set> using namespace std; int main(){ int T; cin >> T; while (T--){ int no, p, q; char slash; cin >> no >> p >> slash >> q; cout << no << " " << q << "/" << (p / q * 2 + 1) * q - p << endl; } }