#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, c, m, x;
  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> c >> m >> x;
    int team = 0;
    int team_temp = 0;
    int reserve;
    if (c > 0 && m > 0) {
      if (c <= m) {
        team = c;
        if (team > x) {
          team = x;
          c = c - team;
          m = m - team;
          x = x - team;
          team_temp = (m + c) / 3;
          if (c <= team_temp) {
            if (c <= m) {
              team_temp = c;
            } else {
              team_temp = m;
            }
          } else {
            if (m <= team_temp) {
              team_temp = m;
            }
          }
          team = team + team_temp;
        }
      } else {
        team = m;
        if (team > x) {
          team = x;
          c = c - team;
          m = m - team;
          x = x - team;
          team_temp = (m + c) / 3;
          if (c <= team_temp) {
            if (c <= m) {
              team_temp = c;
            } else {
              team_temp = m;
            }
          } else {
            if (m <= team_temp) {
              team_temp = m;
            }
          }
          team = team + team_temp;
        }
      }
      cout << team << endl;
    } else {
      cout << 0 << endl;
    }
  }
}
