#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    int a, b;
    cin >> a >> b;
    int s = min(a, b);
    int g = max(a, b);
    if (s <= g / 2)
      cout << s << endl;
    else
      cout << (s + g) / 3 << endl;
  }
  return 0;
}
