#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int Q;
  cin >> Q;
  vector<long long> ans(Q);
  for (int q = int(0); q < int(Q); ++q) {
    long long c, m, x;
    cin >> c >> m >> x;
    long long left = 0;
    long long right = 1e8 + 10;
    while (right - left > 1) {
      long long mid = left + (right - left) / 2;
      if (min(c, m) < mid) {
        right = mid;
      } else {
        long long tx = x;
        tx += c - mid;
        tx += m - mid;
        if (tx >= mid) {
          left = mid;
        } else {
          right = mid;
        }
      }
    }
    ans[q] = left;
  }
  for (int q = int(0); q < int(Q); ++q) {
    cout << ans[q] << endl;
  }
  return 0;
}
