#include <bits/stdc++.h>
using namespace std;
long long mode(long long x, long long m) { return (x % m + m) % m; }
long long mod = 1000000007;
long long inf = 1e15;
long double pi = 2 * acos(0.0);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tc;
  cin >> tc;
  while (tc--) {
    long long c, m, x;
    cin >> c >> m >> x;
    long long l = 0;
    long long r = 1e10;
    long long ans = l;
    while (l <= r) {
      long long mid = (l + r) / 2;
      long long f = 0;
      long long c1 = c;
      long long m1 = m;
      long long x1 = x;
      if (c1 >= mid) {
        c1 = c1 - mid;
      } else
        f = 1;
      if (m1 >= mid) {
        m1 = m1 - mid;
      } else
        f = 1;
      x1 = x + c1 + m1;
      if (x1 < mid) f = 1;
      if (f == 0) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    cout << ans << endl;
  }
}
