#include <bits/stdc++.h>
using namespace std;
long long int minimum(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
int main() {
  long long int q;
  cin >> q;
  while (q--) {
    long long c, m, x;
    cin >> c >> m >> x;
    long long max_team = (c + m + x) / 3;
    long long min = minimum(c, m);
    if (max_team < min)
      cout << max_team << endl;
    else
      cout << min << endl;
  }
  return 0;
}
