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