#include #include #include #include #include #include #include #include #define LL long long #define LD long double #define MAXN #define MAXM #define P 998244353 #define MP make_pair #define PB push_back #define INF 0x3f3f3f3f #define dbg(a...) fprintf(stderr, a) using namespace std; int T, a, b, k; int ksm(int x, int y) { int num=1; while(y) { if(y&1) num=1LL*num*x%P; x=1LL*x*x%P, y>>=1; } return num; } int main() { scanf("%d", &T); while(T--) { scanf("%d%d%d", &a, &b, &k); a=1LL*a*ksm(2, k/2)%P, b=1LL*b*ksm(2, k/2)%P; if(k&1) printf("%d %d\n", (a+b)%P, (a-b+P)%P); else printf("%d %d\n", a, b); } return 0; }