#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int c, m, x;
    cin >> c >> m >> x;
    int k = min(c, m);
    int left = 0;
    if (k == c) {
      left = m - c;
    } else {
      left = c - m;
    }
    left = left + x;
    int ans;
    if (left < k) {
      int v = k - left;
      v = ceil((double)v / 3);
      ans = k - v;
    } else {
      ans = k;
    }
    cout << ans << endl;
  }
  return 0;
}
