#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, i, j;
  cin >> q;
  for (i = 0; i < q; i++) {
    long long c, m, x;
    cin >> c >> m >> x;
    long long total = floor((c + m + x) / 3), t1, t2;
    t1 = min(total, c);
    t2 = min(t1, m);
    cout << t2 << endl;
  }
}
