#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, a, b, c, mn, mx, res;
  int ot, df;
  cin >> tc;
  while (tc--) {
    cin >> a >> b >> c;
    mn = min(a, b);
    if (mn <= c || mn == 0)
      cout << mn << endl;
    else {
      ot = (a + b + c) / 3;
      if (ot <= mn)
        cout << ot << endl;
      else
        cout << mn << endl;
    }
  }
  return 0;
}
