#include <bits/stdc++.h>
int main() {
  int q, c, m, x, f;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d%d", &c, &m, &x);
    f = c < m ? c : m;
    printf("%d\n", (c + m + x) / 3 < f ? (c + m + x) / 3 : f);
  }
  return 0;
}
