#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q, j;
  cin >> q;
  while (q--) {
    long long int c, m, x, ans, temp, t, min, max;
    cin >> c >> m >> x;
    min = c > m ? m : c;
    max = c > m ? c : m;
    if (min <= max - min + x) {
      cout << min << endl;
      continue;
    } else
      cout << (min + max + x) / 3 << endl;
    continue;
  }
}
