#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, n, t, q1, i1 = 0, m, p;
  long long w[10000];
  cin >> q;
  while (i1 < q) {
    w[i1] = 0;
    cin >> n >> m >> p;
    t = min(n, min(m, p));
    n -= t;
    m -= t;
    p -= t;
    w[i1] += t;
    if (p == 0) {
      t = min(min(n, m), (n + m) / 3);
      w[i1] += t;
    }
    i1++;
  }
  for (int i = 0; i < q; i++) {
    cout << w[i] << endl;
  }
  return 0;
}
