#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, c, m, x;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d%d", &c, &m, &x);
    int num = min(min(c, m), x);
    x -= num;
    c -= num;
    m -= num;
    if (x != 0) {
      printf("%d\n", num);
    } else {
      num += min(min((c + m) / 3, c), m);
      printf("%d\n", num);
    }
  }
}
