#include <bits/stdc++.h>
using namespace std;
bool compare(const int &x, const int &y) { return x >= y; }
vector<long long> v;
vector<long long> b;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  vector<long long> v;
  while (t--) {
    long long x, y, z;
    cin >> x >> y >> z;
    long long t1, t2, t3;
    t1 = x;
    t2 = y;
    t3 = z;
    long long d1 = z - abs(x - y);
    long long ans1 = max(x, y) + d1 / 2;
    long long d2 = y - abs(x - z);
    long long ans2 = max(x, z) + d2 / 2;
    long long d3 = x - abs(y - z);
    long long ans3 = max(y, z) + d3 / 2;
    long long ans = min(ans1, min(ans2, ans3));
    cout << ans << endl;
  }
  return 0;
}
