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