#include <iostream>
using namespace std;
int main(){
  int Q;
  cin>>Q;
  for(int i=0;i<Q;i++){
    int c,a,n;
    int can=0,cca=0,ccc=0;
    cin>>c>>a>>n;
      if(1<=n&&1<=a&&1<=c){
        can=min(min(c,a),n);
        a=a-can; c=c-can;
      }
      if(1<=a&&1<=c/2){
        cca=min(c/2,a);
        c=c-cca*2;
      }


      if(1<=c/3){
        ccc=c/3;
      }

    cout<<can+cca+ccc<<endl;
  }
  return 0;
}