#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long x;
  cin >> x;
  while (x--) {
    long long c, m, n;
    cin >> c >> m >> n;
    long long teams = (c + m + n) / 3;
    cout << min(c, min(m, teams)) << endl;
  }
  return 0;
}
