#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q;
  scanf("%lld", &q);
  while (q--) {
    long long int c, m, x, d, a, b, r = 0;
    scanf("%lld %lld %lld", &c, &m, &x);
    if (c == 0 || m == 0)
      d = 0;
    else {
      a = min(c, m);
      a = min(a, x);
      c = c - a;
      m = m - a;
      x = x - a;
      d = a;
      if (c == 0 || m == 0)
        d = a;
      else {
        r = min(c, m);
        if (r * 2 <= c || r * 2 <= m) {
          d += (r + r * 2) / 3;
        } else
          d += (c + m) / 3;
        ;
      }
    }
    printf("%lld\n", d);
  }
}
