#include <bits/stdc++.h>
using namespace std;
int c, m, x;
bool isPossible(int k) {
  if (k > min(c, m)) return false;
  int sps = 0;
  if (c > k) sps += c - k;
  if (m > k) sps += m - k;
  if (x + sps >= k) return true;
  return false;
}
int main() {
  int q;
  cin >> q;
  while (q--) {
    cin >> c >> m >> x;
    int ans;
    if (min(c, m) <= x)
      ans = min(c, m);
    else {
      int lo = 0, hi = 1e8 + 1;
      while (lo < hi) {
        int mid = (lo + hi + 1) / 2;
        if (isPossible(mid))
          lo = mid;
        else
          hi = mid - 1;
      }
      ans = lo;
    }
    cout << ans << '\n';
  }
}
