T=int(input()) M=998244353 for _ in range(T): a,b,c=map(int,input().split()) print((a*a+b*b+c*c)*pow(c*c,M-2,M)%M)