#include <bits/stdc++.h>
const long long N = 2e5 + 5;
const long long inf = LLONG_MAX;
using namespace std;
template <typename T>
void debug(string s, T x) {
  cout << s << " = " << x << "\n";
}
template <typename T, typename... Args>
void debug(string s, T x, Args... args) {
  cout << s.substr(0, s.find(',')) << " = " << x << " | ";
  debug(s.substr(s.find(',') + 2), args...);
}
template <class T>
void print_container(T &container) {
  for (auto &t : container) {
    cout << t << " ";
  }
  cout << "\n";
}
long long a, b, c;
void solve() {
  cin >> a >> b >> c;
  cout << min({a + b, b + c, c + a, (a + b + c) / 2}) << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t;
  cin >> t;
  while (t--) solve();
}
