#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    long long x[3];
    cin >> x[0] >> x[1] >> x[2];
    sort(x, x + 3);
    x[2] -= x[1] - x[0];
    cout << x[1] + x[2] / 2 << endl;
  }
}
