#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long res;
    res = min(a, b);
    long long ans;
    ans = min(res, (a + b) / 3);
    cout << ans << "\n";
  }
  return 0;
}
