#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int nb;
  cin >> nb;
  int c, m, x;
  int y;
  int max;
  int dib;
  for (int i = 0; i < nb; i++) {
    int stock = 0;
    cin >> c >> m >> x;
    y = min(c, m);
    y = min(x, y);
    stock = stock + y;
    c = c - y;
    x = x - y;
    m = m - y;
    if (m == 0 || c == 0) {
      cout << stock << endl;
    } else {
      max = min(c, m);
      dib = (m + c) / 3;
      cout << min(dib, max) + stock << endl;
    }
  }
}
