#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-10;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
void solve() {
  long long a, b, c;
  cin >> a >> b >> c;
  auto calc = [](long long a, long long b, long long c) {
    if (a < b) swap(a, b);
    long long tmp = min(c, a - b);
    b += tmp;
    c -= tmp;
    if (c) {
      a += c - c / 2;
      b += c / 2;
    }
    return min(a, b);
  };
  cout << max({calc(a, b, c), calc(b, c, a), calc(c, a, b)}) << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) solve();
  return 0;
}
