#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const int MAX_LOG = 21;
const int MAX_N = 200005;
struct cmp {
  bool operator()(int a, int b) { return a > b; }
};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int c, m, x;
    cin >> c >> m >> x;
    int l = 0, r = (c + m + x) / 3;
    while (l < r) {
      int mid = (l + r + 1) / 2;
      if (mid <= min(c, m) && (c + m - 2 * mid + x) >= mid) {
        l = mid;
      } else
        r = mid - 1;
    }
    cout << l << endl;
  }
}
