#include <bits/stdc++.h>
using namespace std;
template <class T>
inline istream& operator>>(istream& str, vector<T>& a) {
  for (auto& i : a) str >> i;
  return str;
}
const long long N = 1e6, mod = 1e9 + 7;
void solve() {
  long long n, m;
  cin >> n >> m;
  long long ans = min({(n + m) / 3, n, m});
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
