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