#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  vector<long long> a(3);
  long long k;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    a[2] -= (a[1] - a[0]);
    a[0] = a[1];
    cout << a[0] + a[2] / 2 << '\n';
  }
  return 0;
}
