#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int test;
  cin >> test;
  while (test--) {
    long long p, m, none, cnt = 0, x, y;
    cin >> p >> m >> none;
    x = min(min(p, m), none);
    cnt += x;
    p -= x, m -= x, none -= x;
    y = m + p;
    y /= 3;
    x = min(min(p, m), y);
    cnt += x;
    cout << cnt << endl;
  }
  return 0;
}
