#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int q;
  cin >> q;
  while (q--) {
    long long piles[3];
    cin >> piles[0] >> piles[1] >> piles[2];
    sort(piles, piles + 3);
    long long res = piles[1] + (piles[2] - (piles[1] - piles[0])) / 2;
    cout << res << "\n";
  }
  return 0;
}
