#include <iostream>
using namespace std;

int main()
{
  int q, c, a, n, r;

  cin >> q;
  for (int i = 0; i < q; i++){
    r = 0;
    cin >> c >> a >> n;

    while (c >= 1 && a >= 1 && n >= 1){
      r++;
      c--;
      a--;
      n--;
    }

    while (c >= 2 && a >= 1){
      r++;
      c -= 2;
      a--;
    }

    while (c >= 3){
      r++;
      c -= 3;
    }

    cout << r << "\n";
  }

  return (0);
}