#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  long long x, y, z;
  long long d, s;
  long long i;
  while (n--) {
    scanf("%lld%lld%lld", &x, &y, &z);
    if (x < y) {
      d = x;
      x = y;
      y = d;
    }
    if (x < z) {
      d = x;
      x = z;
      z = d;
    }
    if (y < z) {
      d = y;
      y = z;
      z = d;
    }
    if (2 * (y + z) <= x)
      s = y + z;
    else
      s = (x + y + z) / 3;
    printf("%lld\n", s);
  }
  return 0;
}
