#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long q, c, m, x;
  cin >> q;
  while (q--) {
    cin >> c >> m >> x;
    long long tmp = min(min(m, c), x), res = tmp;
    c -= tmp;
    m -= tmp;
    if (c == 0 || m == 0)
      cout << res << "\n";
    else {
      tmp = min(c, min(m, (c + m) / 3));
      cout << res + tmp << "\n";
    }
  }
  return 0;
}
