#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long q;
  cin >> q;
  while (q--) {
    long long c, m, x, result;
    cin >> c >> m >> x;
    if (x <= c && x <= m) {
      result = x;
      c -= x;
      m -= x;
      result += min({c, m, (c + m) / 3});
    } else {
      result = min({c, m});
    }
    cout << result << "\n";
  }
  return 0;
}
