#include #define int long long using namespace std; const int mod=998244353; void read(int &data){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){ if(ch=='-') f=f*-1; ch=getchar(); } while(ch>='0'&&ch<='9'){ x=x*10+ch-'0'; ch=getchar(); } data=x*f; } void write(int x){ if(x>10) write(x/10); putchar(x%10); } int fpow(int a,int p){ int res=1; while(p){ if(p&1) res=res*a%mod; a=a*a%mod; p>>=1; } return res%mod; } int t,a,b,k,tmp; signed main(){ cin>>t; while(t--){ cin>>a>>b>>k; tmp=k/2; a=a*fpow(2,tmp); b=b*fpow(2,tmp); if(k&1){ tmp=a; a=(tmp+b+mod)%mod; b=(tmp-b+mod)%mod; } cout<<(a+mod)%mod<<" "<<(b+mod)%mod<