#include <bits/stdc++.h>
using namespace std;
double PI = 3.141592653589793;
const double EPS = 1e-6;
const int N = 1e6 + 5;
const long long mod = 1e9 + 7;
int oo = 1e9;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long c, m, x;
int main() {
  int test;
  scanf("%d", &test);
  while (test--) {
    scanf("%lld%lld%lld", &c, &m, &x);
    long long l = 0, r = min(c, m);
    long long ans = 0;
    while (l <= r) {
      long long mid = (l + r) / 2;
      long long rem = c + m - mid * 2 + x;
      if (rem >= mid) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    printf("%lld\n", ans);
  }
}
