#include <bits/stdc++.h>
using namespace std;
int a[1000];
int num[20];
int main() {
  int n;
  cin >> n;
  int c, m, x;
  while (n--) {
    cin >> c >> m >> x;
    int t = min(c, m);
    t = min(t, (c + m + x) / 3);
    cout << t << endl;
  }
  return 0;
}
