#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
void solve() {
  int a, b;
  cin >> a >> b;
  int mn = min(a, b), mx = max(a, b);
  if (2 * mn <= mx) {
    cout << mn;
  } else {
    int ans = mx - mn, temp = mn - ans;
    ans += ((2 * temp) / 3);
    cout << ans;
  }
  cout << "\n";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
