#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 a = min(c, m);
    long long left = m - a + x + c - a;
    if (left >= a) {
      cout << a << endl;
    } else {
      long long t;
      t = x;
      c -= x;
      m -= x;
      if (c == m) {
        t += (c + m) / 3;
      } else {
        if (c > m) {
          t += c - m;
          long long x = c - m;
          c = c - (2 * x);
          m = m - x;
          t += (c + m) / 3;
        } else {
          t += m - c;
          long long x = m - c;
          m = m - (2 * x);
          c = c - x;
          t += (c + m) / 3;
        }
      }
      cout << t << endl;
    }
  }
  return 0;
}
