#include <bits/stdc++.h>
using namespace std;
void sb() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  int x;
  cin >> x;
  while (x--) {
    int n, m;
    cin >> n >> m;
    int maxx = (n + m) / 3;
    cout << min(min(n, m), maxx) << endl;
  }
}
