#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, j, q, l = 0, r = 0, h, n, k, x, y;
  cin >> t;
  while (t--) {
    cin >> x >> y;
    if (2 * min(x, y) <= max(x, y)) {
      cout << min(x, y) << endl;
    } else {
      cout << (x + y) / 3 << endl;
    }
  }
}
