#include #define LL long long using namespace std; const LL mod=998244353; LL a,b,k; int main(){ for(int _=(scanf("%d",&_),_);_;_--){ scanf("%lld%lld%lld",&a,&b,&k); int t=k/2; LL res=1,x=2; while(t){ if(t&1)res=res*x%mod; x=x*x%mod; t>>=1; } a=a*res%mod;b=b*res%mod; if(k&1)printf("%lld %lld\n",(a+b)%mod,(a-b+mod)%mod); else printf("%lld %lld\n",a,b); } return 0; }