#include typedef long long ll; using namespace std; const int mod = 998244353; typedef uint32_t u32; typedef uint64_t u64; u32 pw(u32 x,u32 y){u32 a=1;while(y){if(y%2)a=(u64)a*x%mod;x=(u64)x*x%mod;y/=2;}return a;} ll inv(ll x){return pw(x,mod-2);} int main() { cin.tie(0) -> sync_with_stdio(false); int t; cin >> t; while (t--) { ll a, b, c; cin >> a >> b >> c; cout << (a*a + b*b + c*c) % mod * inv(c*c % mod) % mod << '\n'; } }