#include using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; typedef double db; #define ls(x) ((x)<<1) #define rs(x) ((x)<<1|1) #define low(x) ((x)&-(x)) #define all(x) x.begin(),x.end() #define mp make_pair #define X first #define Y second #ifdef _DEBUG const int N=1e3+10; #else const int N=1e6+10; #endif // const ll mod=1e9+7; const ll mod=998244353; inline ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);} inline ll q_pow(ll a,ll x){ll ans=1,tmp=a;while(x){if(x&1)(ans*=tmp)%=mod;(tmp*=tmp)%=mod;x>>=1;}return ans;} template inline void re(T &N){int f=1;char c;while((c=getchar())< '0'||c> '9')if(c=='-')f=-1;N=c-'0';while((c=getchar())>='0'&&c<='9')N=N*10+c-'0';N*=f;} templateinline void re(T&x,T_&...y){re(x),re(y...);} int m,n,t=1,st,en; int a[N],b[N]; char s[N]; int main() { #ifdef _DEBUG freopen("data.txt","r",stdin); #endif re(t); while(t--) { ll a,b; re(a,b,n); a=a*q_pow(2,n/2)%mod; b=b*q_pow(2,n/2)%mod; if(n&1)printf("%lld %lld\n",(a+b)%mod,(a-b+mod)%mod); else printf("%lld %lld\n",a,b); } }