#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
inline ll LCM(ll a, ll b) { return a / GCD(a, b) * b; }
inline ll powint(ll x, ll y) {
  ll r = 1;
  while (y) {
    if (y & 1) r *= x;
    x *= x;
    y >>= 1;
  }
  return r;
}
inline ll powmod(ll x, ll y, ll m = MOD) {
  ll r = 1;
  while (y) {
    if (y & 1) r *= x;
    x *= x;
    r %= m;
    x %= m;
    y >>= 1;
  }
  return r;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  ll n;
  cin >> n;
  ll a[3];
  for (ll i = 0; i < (n); i++) {
    for (ll j = 0; j < (3); j++) cin >> a[j];
    sort(a, a + 3);
    ll alice = a[0], bob = a[1];
    alice += a[1] - a[0];
    a[2] -= a[1] - a[0];
    cout << alice + a[2] / 2 << endl;
  }
  return 0;
}
