#include #define RAN(v) v.begin(), v.end() #define pb push_back #define lb lower_bound #define ub upper_bound using namespace std; typedef long long ll; template inline void upd1(T1& a, const T2& b) { a = a < b ? a : b; } template inline void upd2(T1& a, const T2& b) { a = b < a ? a : b; } ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } struct Ano { operator ll() { ll x = 0, y = 0, c = getchar(); while (c < 48) { y = c == 45; c = getchar(); } while (c > 47) { x = x*10 + c-48; c = getchar(); } return y ? -x : x; } } buf; const int p = 998244353; struct mat { using arr = ll[2][2]; arr a; operator arr&() { return a; } }; mat operator*(mat a, mat b) { return { (a[0][0] * b[0][0] + a[0][1] * b[1][0]) % p, (a[0][0] * b[0][1] + a[0][1] * b[1][1]) % p, (a[1][0] * b[0][0] + a[1][1] * b[1][0]) % p, (a[1][0] * b[0][1] + a[1][1] * b[1][1]) % p }; } mat pow(mat a, int n) { mat s = {1, 0, 0, 1}; for (; n; n >>= 1) { if (n & 1) s = s * a; a = a * a; } return s; } int main() { int t = buf; while (t--) { int a = buf, b = buf, k = buf; mat c = {1, 1, 1, p - 1}; c = pow(c, k); printf("%lld %lld\n", (c[0][0] * a + c[0][1] * b) % p, (c[1][0] * a + c[1][1] * b) % p); } }