#include <bits/stdc++.h>
using namespace std;
int n, q, a[100005];
int main() {
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int c, m, x;
    scanf("%d%d%d", &c, &m, &x);
    int sum = c + m + x;
    printf("%d\n", min(min(c, m), sum / 3));
  }
  return 0;
}
