#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
int main(int argc, char const *argv[]) {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long a, b, c;
    cin >> a >> b >> c;
    long long x = a + b + c;
    long long ans = x / 3;
    ans = min(ans, min(a, b));
    cout << ans << endl;
  }
}
