#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, i, j, n, k, l, a, b;
  cin >> t;
  for (i = 1; i <= t; i++) {
    cin >> a >> b;
    if (2 * a < b) {
      k = a;
    } else if (2 * b < a)
      k = b;
    else {
      k = (a + b) / 3;
    }
    cout << k << "\n";
  }
  return 0;
}
