#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q;
  cin >> q;
  while (q--) {
    long long c, m, x;
    cin >> c >> m >> x;
    long long s = (c + m + x) / 3;
    long long p;
    (c < m) ? p = c : p = m;
    long long ans;
    (p < s) ? ans = p : ans = s;
    cout << ans << endl;
  }
}
