#include #define ll long long #define mp make_pair #define fi first #define se second #define pb push_back #define vi vector #define pi pair #define mod 998244353 template bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;} template bool chkmax(T &a, T b){return (b > a) ? a = b, 1 : 0;} ll ksm(ll a, ll b) {if (b == 0) return 1; ll ns = ksm(a, b >> 1); ns = ns * ns % mod; if (b & 1) ns = ns * a % mod; return ns;} using namespace std; const int maxn = 1005; char inp[maxn]; char ed[maxn]; int main() { int t; cin >> t; while (t--) { int a, b, k; cin >> a >> b >> k; ll cr = ksm(2, k / 2); k %= 2; if (k) { ll c = a; a = (a + b) % mod; b = (c - b) % mod; } a = a * cr % mod; b = b * cr % mod; if (a < 0) a += mod; if (b < 0) b += mod; printf("%lld %lld\n", a, b); } return 0; }