#include using namespace std; typedef long long ll; const int MOD = 998244353; ll ksm(ll a,ll b) { ll t = 1; while(b){ if(b&1) t = t*a%MOD; a = a*a%MOD; b >>= 1; } return t%MOD; } int main() { int t; scanf("%d",&t); while(t--) { ll a,b,k; cin>>a>>b>>k; ll m = (k&1 ? (k - 1)/2:k/2); ll mi = ksm(2,m); ll t = a; if(k&1) a = mi*(a + b)%MOD,b = mi*(t - b)%MOD; else a = mi*a%MOD,b = mi*b%MOD; printf("%lld %lld\n",(a + MOD)%MOD,(b + MOD)%MOD); } return 0; }