#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int a, b;
    cin >> a >> b;
    int ans = min(a, min(b, (a + b) / 3));
    cout << ans << endl;
  }
}
