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