#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q-- > 0) {
    int c, m, x;
    cin >> c >> m >> x;
    int s = min(min(x, c), m);
    c -= s;
    m -= s;
    int dcm = abs(c - m);
    if (dcm > min(m, c)) {
      s += min(m, c);
    } else {
      s += dcm + 2 * (min(c, m) - dcm) / 3;
    }
    cout << s << endl;
  }
  return 0;
}
