#include <bits/stdc++.h>
using namespace std;
int q, n;
int c, m, x;
void input() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> q;
  while (q--) {
    cin >> c >> m >> x;
    int res = 0;
    res += min(x, min(c, m));
    x -= res;
    c -= res;
    m -= res;
    if (c <= m / 2) {
      res += c;
    } else {
      if (m <= c / 2) {
        res += m;
      } else {
        res += (c + m) / 3;
      }
    }
    cout << res << "\n";
  }
}
int main() {
  input();
  return 0;
}
