#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long a, b, c, cd, mt, nm;
    cin >> a >> b >> c;
    if ((a >= c) && (b >= c)) {
      cd = min(a, b);
      if (((a + b + c) / 3) > cd)
        cout << cd << endl;
      else
        cout << (a + b + c) / 3 << endl;
    } else {
      cd = min(a, b);
      mt = max(a, b);
      c = c + (mt - cd);
      cout << min(c, cd) << endl;
    }
  }
}
