#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int a, b, ans, k, x, y;
    cin >> a >> b;
    ans = (a + b) / 3;
    ans = min(ans, a);
    ans = min(ans, b);
    cout << ans << "\n";
  }
}
