#include using namespace std; typedef long long ll; const int maxl=3e5+10; const int mod=998244353; int n,m,k,cnt,tot,cas,ans; int a[maxl],b[maxl]; char s[maxl]; inline ll qp(ll a,ll b) { ll ans=1,cnt=a; while(b) { if(b&1) ans=ans*cnt%mod; cnt=cnt*cnt%mod; b>>=1; } return ans; } inline void prework() { ll a,b,k,d; scanf("%lld%lld%lld",&a,&b,&k); d=k/2; if(k&1) { printf("%lld %lld\n",qp(2,d)*(a+b)%mod,(qp(2,d)*(a-b)%mod+mod)%mod); } else printf("%lld %lld\n",qp(2,d)*a%mod,qp(2,d)*b%mod); } inline void mainwork() { } inline void print() { } int main() { int t=1; scanf("%d",&t); for(cas=1;cas<=t;cas++) { prework(); mainwork(); print(); } return 0; }