#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e5 + 1;
void solve() {
  long long int n, m, k, p = 0, q = 0, s = 0, c = 0, i, j;
  cin >> n >> m >> k;
  if (n == 0 || m == 0 || (n == 1 && m == 1 && k == 0)) {
    cout << 0 << "\n";
    return;
  }
  p = min(n, min(m, k));
  s = p;
  n -= p, m -= p, k -= p;
  if (!n && m && k) p = m, q = k;
  if (!m && n && k) p = n, q = k;
  if (!k && m && n) p = n, q = m, c = 1;
  if (c)
    if (max(p, q) >= 2 * min(p, q))
      cout << s + min(p, q) << "\n";
    else
      cout << s + (p + q) / 3 << "\n";
  else {
    cout << s << "\n";
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
