#include <bits/stdc++.h>
int t, a, b, c;
int min(int a, int b) { return a < b ? a : b; }
int main() {
  scanf("%d", &t);
  for (int i = 1; i <= t; ++i)
    scanf("%d%d%d", &a, &b, &c),
        printf("%d\n", min(a, min(b, (a + b + c) / 3)));
  return 0;
}
