#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long c, m, b;
    cin >> c >> m >> b;
    if (b < c && b < m) {
      c -= b;
      m -= b;
      if (m > c) {
        swap(c, m);
      }
      long long ans1 = (c + m) / 3, ans2 = c, ans3 = m;
      if (ans1 < ans2) {
        if (ans1 < ans3)
          cout << ans1 + b;
        else
          cout << ans3 + b;
      } else {
        if (ans2 < ans3)
          cout << ans2 + b;
        else
          cout << ans3 + b;
      }
      cout << endl;
    } else {
      if (c < m)
        cout << c << endl;
      else
        cout << m << endl;
    }
  }
  return 0;
}
