#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long count, n, s, sum, ans, i, j, k, tt, t, x, y, z, c, a[100005] = {};
  string ss;
  vector<long long> vv;
  map<long long, long long> ma;
  cin >> tt;
  while (tt--) {
    cin >> i >> j >> k;
    n = (i + j + k) / 3;
    ans = min(n, i);
    ans = min(ans, j);
    cout << ans << endl;
  }
}
