#include <bits/stdc++.h>
using namespace std;
long long int hcf(long long int a, long long int b) {
  if (!a)
    return (b);
  else
    return (hcf(b % a, a));
}
long long findGCD(vector<long long> arr, long long n) {
  long long result = arr[0];
  for (long long i = 1; i < n; i++) {
    result = hcf(arr[i], result);
    if (result == 1) {
      return 1;
    }
  }
  return result;
}
long long int lcm(long long int a, long long int b) {
  return ((a * b) / hcf(a, b));
}
bool sortbysec(long int a, long int b) { return (a > b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  while (t--) {
    long long n, m, a, b, c, ans = 0, d = 0, x, e;
    cin >> n >> m >> x;
    if (n == 0 || m == 0) {
      cout << "0";
    } else {
      if (n == m && m == x) {
        cout << n;
      } else {
        a = min(n, m);
        if (x >= a) {
          cout << a;
        } else {
          b = x;
          n = n - b;
          m = m - b;
          e = b;
          c = n;
          if (m == n) {
            if (m % 3 == 0) {
              cout << 2 * (m / 3) + e;
            } else {
              a = 3 * (m / 3);
              c = m;
              m = m - a;
              n = n - a;
              if (m == 1 && n == 1) {
                m = c;
                cout << 2 * (m / 3) + e;
              } else {
                m = c;
                cout << (2 * (m / 3)) + 1 + e;
              }
            }
          } else {
            if ((n <= 1 && m <= 1) || (n == 0 || m == 0)) {
              cout << e;
            } else {
              a = min(n, m);
              b = max(n, m);
              if (b >= 2 * a) {
                cout << a + e;
              } else {
                ans = b - a;
                n = 2 * a - b;
                m = 2 * a - b;
                if (n <= 1) {
                  cout << ans + e;
                } else {
                  if (m % 3 == 0) {
                    cout << 2 * (m / 3) + e + ans;
                  } else {
                    a = 3 * (m / 3);
                    c = n;
                    m = m - a;
                    n = n - a;
                    if (m == 1 && n == 1) {
                      m = c;
                      cout << 2 * (m / 3) + e + ans;
                    } else {
                      m = c;
                      cout << (2 * (m / 3)) + 1 + e + ans;
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
    cout << endl;
  }
  return 0;
}
