#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, mn, mx;
  cin >> t;
  while (t--) {
    cin >> a >> b;
    mn = min(a, b);
    mx = max(a, b);
    if (a == 0 || b == 0)
      cout << 0 << '\n';
    else if (mn * 2 <= mx)
      cout << mn << '\n';
    else
      cout << (a + b) / 3 << '\n';
  }
  return 0;
}
