#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f;
const long long MAXN = 0x7fffffff;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
void file() {}
void pr(bool num) { cout << (num == 1 ? "YES" : "NO") << "\n"; }
signed main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long t, n;
  cin >> t;
  while (t--) {
    long long a, b, c;
    cin >> a >> b >> c;
    long long ans = min(a, b);
    ans = min(ans, c);
    a -= ans;
    b -= ans;
    c -= ans;
    long long num = min(a, b);
    a -= num;
    b -= num;
    long long sum = a + b + c;
    if (num <= sum)
      ans += num;
    else {
      ans += sum;
      num -= sum;
      ans += num / 3 * 2;
      if (num % 3 == 2) ans++;
    }
    cout << ans << "\n";
  }
  return 0;
}
