#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    long long ans = 0;
    long long num = min(min(a, b), c);
    ans += num;
    a -= num;
    b -= num;
    c -= num;
    if (a > b) {
      swap(a, b);
    }
    num = min(a, (a + b) / 3);
    ans += num;
    cout << ans << endl;
  }
  return 0;
}
