#include <bits/stdc++.h>
using namespace std;
long long t;
long long a;
long long b;
long long c;
int main() {
  cin >> t;
  for (long long i = 0; i < t; i++) {
    cin >> a >> b >> c;
    long long eka = 0;
    long long toka = 0;
    vector<long long> juttu = {a, b, c};
    sort(juttu.begin(), juttu.end());
    a = juttu[0];
    b = juttu[1];
    c = juttu[2];
    eka = a;
    toka = b;
    if (eka < toka) {
      long long ero = toka - eka;
      eka += ero;
      c -= ero;
    } else {
      long long ero = eka - toka;
      toka += ero;
      c -= ero;
    }
    eka += c / 2;
    toka += c / 2;
    cout << min(eka, toka) << "\n";
  }
}
