#include <bits/stdc++.h>
using namespace std;
int ch(int c, int m, int x, int mid) {
  if (mid <= c && mid <= m && mid <= (x + (c - mid) + (m - mid)))
    return 1;
  else
    return 0;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int c, m, x;
    cin >> c >> m >> x;
    int n = min(m, c);
    int l = 0, r = n, ans = 0;
    while (r >= l) {
      int mid = l + (r - l) / 2;
      if (ch(c, m, x, mid)) {
        ans = mid;
        l = mid + 1;
      } else
        r = mid - 1;
    }
    cout << ans << "\n";
  }
  return 0;
}
