#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using i128=__int128_t;
using u128=__uint128_t;
using ld=long double;
void solve()
{//先用小数据尝试 发现经过较少次数的调整后 a,b,c会相等 所以直接写一个暴力解 当a==b==c时break即可 如果直接暴力 大数据会超时
ll a,b,c,k;
cin >> a >> b >> c >> k;
while(k--)
{
if(a==b&&b==c) break;
int temp1=a,temp2=b,temp3=c;
a=(temp2+temp3)/2;
b=(temp1+temp3)/2;
c=(temp1+temp2)/2;
}
cout << a << " " << b << " " << c << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t=1;
cin >> t;
while(t--)
{
solve();
}
return 0;
}