#include <bits/stdc++.h>
using namespace std;
int main() {
  int cases, diff;
  cin >> cases;
  int* math = new int[cases];
  int* code = new int[cases];
  int* none = new int[cases];
  int* total = new int[cases];
  for (int i = 0; i < cases; i++) {
    cin >> code[i] >> math[i] >> none[i];
    if (math[i] > code[i]) {
      diff = math[i] - code[i];
      math[i] -= diff;
      none[i] += diff;
    } else if (math[i] < code[i]) {
      diff = code[i] - math[i];
      code[i] -= diff;
      none[i] += diff;
    }
    if (none[i] >= math[i])
      total[i] = math[i];
    else if (none[i] < math[i]) {
      total[i] = none[i];
      math[i] -= none[i];
      code[i] -= none[i];
      total[i] += ((code[i] + math[i]) / 3);
    }
  }
  for (int j = 0; j < cases; j++) cout << total[j] << endl;
}
