#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
std::pair<T, U> operator+(const std::pair<T, U> &L, const std::pair<T, U> &R) {
  return {L.first + R.first, L.second + R.second};
}
void debug_out() { cerr << "\n"; }
template <typename H, typename... T>
void debug_out(H h, T... t) {
  cerr << " " << (h);
  debug_out(t...);
}
const long long INF64 = 1e18;
const int INF32 = 1e9;
const int MOD = 1e9 + 7;
const long double PI = acos(-1.0L);
const long double EPS = static_cast<long double>(1e-9);
int norm(int a) { return ((a % MOD) + MOD) % MOD; }
int mul(int a, int b) { return int(a * 1LL * b % MOD); }
int binPow(int a, int k) {
  int ans = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) {
      ans = mul(ans, a);
    }
    a = mul(a, a);
  }
  return ans;
}
int inv(int a) {
  int b = binPow(a, MOD - 2);
  assert(mul(a, b) == 1);
  return b;
}
const int N = 1e6 + 7;
int c, m, x;
void init() { scanf("%d %d %d", &c, &m, &x); }
int minCM;
int res;
void solve() {
  minCM = min(c, m);
  res = min(minCM, x);
  c -= res, m -= res, x -= res;
  if (c and m) {
    res += min((c + m) / 3, min(c, m));
  }
  printf("%d\n", res);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    init();
    solve();
  }
  return 0;
}
