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