#include <iostream>
#include <cmath>
using namespace std;
double d[24];
void solve() {
for (int i = 0; i < 24; i++) cin >> d[i];
double mean = 0;
for (int i = 0; i < 24; i++) mean += d[i];
mean /= 23;
double s = 0;
for (int i = 0; i < 24; i++) s += pow(d[i] - mean, 2);
double e = d[23];
for (int i = 0; i < 12; i++) {
if (56 > s && i <= 5) cout << e << " ";
else if (41 > s && i <= 6) cout << e << " ";
else if (25 > s && i <= 7) cout << e << " ";
else if (18 > s && i <= 12) cout << e << " ";
else if (i <= 4) cout << e << " ";
else cout << "? ";
}
cout << endl;
}
int main() {
int n;
cin >> n;
while (n) {
n--;
solve();
}