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