#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t;
  long long int mn, mx, noob;
  cin >> t;
  while (t--) {
    long long int flag = 0;
    cin >> mn >> mx >> noob;
    if (mn > mx) swap(mx, mn);
    if (noob >= mn) {
      cout << mn << endl;
      flag = 1;
      continue;
    }
    long long int ans = 0;
    ans = noob;
    mn -= noob;
    mx -= noob;
    long long int p = (mx - mn);
    if (p > mn)
      ans += mn;
    else {
      ans += p;
      mx -= p * 2;
      mn -= p;
      ans += (mn + mx) / 3;
    }
    cout << ans << endl;
  }
  return 0;
}
