#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, c;
  cin >> t;
  while (t--) {
    cin >> a >> b >> c;
    if (a < b) swap(a, b);
    if (c + a - b >= b)
      cout << b << endl;
    else {
      c = c + a - b;
      if ((b - c) % 3 > 0)
        b = b - ((b - c) / 3) - 1;
      else
        b = b - (b - c) / 3;
      cout << b << endl;
    }
  }
}
