#include <bits/stdc++.h>
using namespace std;
bool sorter(const vector<int>& v1, const vector<int>& v2) {
  if (v1[0] != v2[0]) return v1[0] > v2[0];
  return v1[1] < v2[1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int quer;
  quer = 1;
  cin >> quer;
  for (int qe = 0; qe < quer; ++qe) {
    long long a, b;
    cin >> a >> b;
    long long ans = min(a, (min(b, (a + b) / 3)));
    cout << ans << "\n";
  }
  return 0;
}
