#include using namespace std; const int mod=998244353; long long ksm(long long x,long long y) { long long ans=1; while(y) { if(y&1) ans=ans*x%mod; y>>=1; x=x*x%mod; } return ans; } int main() { int t; cin>>t; while(t--) { long long a,b,k; scanf("%lld%lld%lld",&a,&b,&k); { long long base=ksm(2,k/2),ans; if(k%2==0) printf("%lld %lld\n",(base*a%mod+mod)%mod,(base*b%mod+mod)%mod); else printf("%lld %lld\n",(base*(a+b)%mod+mod)%mod,(base*(a-b)%mod+mod)%mod); } } }