#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int c, m, x, z;
    cin >> c >> m >> x;
    z = min(m, c);
    if (x >= z) {
      cout << z << endl;
    } else {
      if (x + abs(c - m) >= z) {
        cout << z << endl;
        continue;
      } else {
        long long t = x;
        c = c - x;
        m = m - x;
        t = t + ((m + c) / 3);
        cout << t << endl;
      }
    }
  }
  return 0;
}
