#include<iostream>
#include<algorithm>
#define N 3

using namespace std;
int x[N];

int solve(){
  int m1=min(x[0], min(x[1], x[2]));
  int ans = m1;
  for(int i=0; i<N; ++i) x[i]-=m1;
  int m2 = x[0]>=2*x[1] ? x[1]:x[0]/2;
  ans += m2;
  x[0] -= 2*m2;
  ans += x[0]/3;
  return ans;
}

int main(){
  int q;
  cin >> q;
  for(int i=0; i<q; ++i){
    cin >> x[0] >> x[1] >> x[2];
    cout << solve() << endl;
  }
  return 0;
}