#include <bits/stdc++.h>
int main() {
  long long n, c, m, x, q, p;
  scanf("%lld", &n);
  while (n--) {
    scanf("%lld %lld %lld", &c, &m, &x);
    q = c;
    if (q > m) q = m;
    p = c + m + x - q * 3;
    if (p >= 0) printf("%lld\n", q);
    if (p < 0) printf("%lld\n", (q * 3 + p) / 3);
  }
  return 0;
}
