#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long c, t, first;
  cin >> c >> t >> first;
  long long r = first + max(c, t) - min(c, t);
  long long m = min(c, t);
  long long cc = ceil((m - r) / 3.0);
  cout << m - max(cc, (long long)0) << '\n';
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
