#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return (!y) ? x : gcd(y, x % y); }
long long lcm(long long x, long long y) { return ((x / gcd(x, y)) * y); }
long long fact(long long n) { return !n ? 1 : n * fact(n - 1); }
const int N = 1000000000;
map<int, bool> prime;
void sieve_v1() {
  prime[0] = prime[1] = 1;
  for (int i = 2; i < N; i++) {
    if (!prime[i]) {
      for (int j = i * 2; j < N; j += i) {
        prime[j] = 1;
      }
    }
  }
}
long long nCr(long long n, long long r) {
  long long ans = 1;
  long long div = 1;
  for (long long i = r + 1; i <= n; i++) {
    ans = ans * i;
    ans /= div;
    div++;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int o, q, c, m, x, ans, mi;
  cin >> q;
  while (q--) {
    ans = 0;
    cin >> c >> m >> x;
    o = min(c, min(m, x));
    c -= o;
    m -= o;
    x -= o;
    ans += o;
    if (c != m && min(c, m) < abs(c - m)) {
      o = max(c, m) / 2;
      mi = min(c, m);
      ans += min(o, mi);
    } else {
      if (c != m) {
        ans += abs(c - m);
        c = m = min(c, m) - abs(c - m);
      }
      o = max(c, m);
      mi = min(c, m);
      c -= o * 2 / 3;
      m -= o / 3;
      ans += o / 3;
      ans += min(c, m / 2);
    }
    cout << ans << endl;
  }
  return 0;
}
