#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int avg;
  cin >> n;
  int math, coder, no;
  for (int i = 0; i < n; i++) {
    cin >> math >> coder >> no;
    avg = (math + coder + no) / 3;
    cout << min(min(math, coder), avg) << endl;
  }
}
