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