#include <bits/stdc++.h>
using namespace std;
const int MAX = 105;
const int INF = 1e9;
int main() {
  int t;
  long long c, m, x;
  scanf("%d", &t);
  while (t--) {
    scanf("%lld%lld%lld", &c, &m, &x);
    long long sol = 0;
    long long teams = min(c, m);
    c -= teams;
    m -= teams;
    long long members = c + m + x;
    long long left = 0;
    long long right = teams;
    while (left <= right) {
      long long mid = (left + right) / 2LL;
      long long tt = mid;
      long long mm = members + 2LL * (teams - mid);
      if (mm >= tt) {
        sol = mid;
        left = mid + 1;
      } else {
        right = mid - 1;
      }
    }
    printf("%lld\n", sol);
  }
  return 0;
}
