#include using namespace std; typedef long long s64; const int D=998244353; s64 pow_mod(s64 x,int y){ s64 ans=1; while(y){ if(y&1)ans=ans*x%D; x=x*x%D;y>>=1; } return ans; } int main(){ #ifdef kcz freopen("1.in","r",stdin);//freopen("1.out","w",stdout); #endif int tt; cin>>tt; while(tt--){ int a,b,k; scanf("%d%d%d",&a,&b,&k); a=a*pow_mod(2,k/2)%D; b=b*pow_mod(2,k/2)%D; if(k%2){ int c=a+b,d=a-b; a=c%D;b=(d+D)%D; } printf("%d %d\n",a,b); } }