#include #define fo(i,a,b) for(int i=a;i<=b;++i) #define fod(i,a,b) for(int i=a;i>=b;--i) using namespace std; typedef long long LL; typedef pair pii; const int N=100500,mo=998244353; int read(int &n) { bool q=0;n=0;char ch=' '; for(;ch!='-'&&(ch<'0'||ch>'9');ch=getchar()); if(ch=='-')ch=getchar(),q=1; for(;ch>='0'&&ch<='9';ch=getchar())n=(n<<3)+(n<<1)+ch-48; return q?n=-n:n; } unsigned seed = std::chrono::system_clock::now().time_since_epoch().count(); mt19937 rand_num(seed); // 大随机数 int RD(int q){return rand_num()%q;} int n,m,ans; int a[N]; LL ksm(LL q,int w) { LL ans=1; for(;w;w>>=1,q=q*q%mo)if(w&1)ans=ans*q%mo; return ans; } int main() { int q,w,_; read(_); while(_--) { int K; read(q),read(w),read(K); LL t=ksm(2,K/2); K%=2; q=q*t%mo,w=w*t%mo; if(K) { q=q+w; w=q-w*2; } printf("%d %d",(q%mo+mo)%mo,(w%mo+mo)%mo); printf("\n"); } return 0; }