#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    int totmake = (a + b + c) / 3;
    if (a == 0 || b == 0 || totmake == 0) {
      cout << 0 << endl;
    } else if (a <= b && a <= totmake) {
      cout << a << endl;
    } else if (b <= a && b <= totmake) {
      cout << b << endl;
    } else {
      cout << totmake << endl;
    }
  }
}
