#include <bits/stdc++.h>
using namespace std;
const int mx = 1e5 + 10;
long long q, c, m, x;
long long solve() {
  long long min_yq = min(c, m);
  long long max_v = max(c, m);
  if (x >= min_yq) return min_yq;
  if (max_v - min_yq + x >= min_yq) return min_yq;
  return (c + m + x) / 3;
}
int main() {
  scanf("%lld", &q);
  for (long long i = 1; i <= q; i++) {
    scanf("%lld %lld %lld", &c, &m, &x);
    printf("%lld\n", solve());
  }
  return 0;
}
