#include #define LL long long #define dl double #define Pi pair #define SZ(a) ((int)a.size()) using namespace std; const int P = 998244353; int T; int a,b,k; int fst(int x,int y){ int ret = 1; while(y){ if(y & 1)ret = 1ll * ret * x % P; x = 1ll * x * x % P;y /= 2; } return ret; } int main(){ // freopen("in.txt","r",stdin); // freopen("o.txt","w",stdout); std::ios::sync_with_stdio(false); std::cin.tie(nullptr); cin >> T; while(T--){ cin >> a >> b >> k; a = 1ll * a * fst(2,k / 2) % P; b = 1ll * b * fst(2,k / 2) % P; if(k & 1)cout << (a + b) % P << " " << (a - b + P) % P << endl; else cout << a << " " << b << endl; } return 0; } /**/