#include <bits/stdc++.h>
using namespace std;
long long int a[4];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    long long int b = a[0], c = a[1], d = a[2];
    long long int e = a[1] - a[0];
    d = d - e;
    c += d / 2;
    cout << c << endl;
  }
  return 0;
}
