#include using namespace std; typedef long long ll; const ll P=998244353; int tes,n; ll a,b; ll qpow(ll x,ll y){ ll res=1; for(;y;y>>=1,x=x*x%P)if(y&1)res=res*x%P; return res; } void solve(){ scanf("%lld%lld%d",&a,&b,&n); ll m=qpow(2,n>>1); a=a*m%P,b=b*m%P; if(n&1)printf("%lld %lld\n",(a+b)%P,(a-b+P)%P); else printf("%lld %lld\n",a,b); } int main() { scanf("%d",&tes); while(tes--)solve(); return 0; }