MOD = 998244353 # Precompute four variables sum (for H=2, W=2 case) max_four = 4 * 9 four_dp = [0] * (max_four + 1) four_dp[0] = 1 for _ in range(4): new_dp = [0] * (len(four_dp) + 9) for s in range(len(four_dp)): if four_dp[s] == 0: continue for k in range(10): new_dp[s + k] = (new_dp[s + k] + four_dp[s]) % MOD four_dp = new_dp[:max_four + 1] T = int(input()) for _ in range(T): W, H, X = map(int, input().split()) # Determine the case if H >= 3 and W >= 3: print(1 if X == 0 else 0) elif H == 1 or W == 1: if (H == 1 and W == 1) or (W == 1 and H == 1): print(1 if 0 <= X <= 9 else 0) else: if H == 1: K = W else: K = H if K == 2: if X < 0 or X > 18: print(0) else: if X <= 9: print((X + 1) % MOD) else: print((19 - X) % MOD) else: print(1 if 0 <= X <=9 else 0) elif H == 2 and W == 2: if X < 0 or X > 36: print(0) else: print(four_dp[X] % MOD) elif (H == 2 and W >= 2) or (W == 2 and H >= 2): max_X = 6 * 9 # 54 if X < 0 or X > max_X: print(0) else: total = 0 for s in range(0, X + 1): term = pow(s + 1, 2, MOD) * pow(X - s + 1, 2, MOD) term %= MOD total = (total + term) % MOD print(total % MOD) else: print(0)