#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int s, d, i, j, k;
    cin >> s >> d;
    int mx = max(s, d);
    int mn = min(s, d);
    int x = s + d;
    if (mn == 0)
      cout << "0" << endl;
    else if (mx >= 2 * mn)
      cout << mn << endl;
    else {
      cout << x / 3 << endl;
    }
  }
}
