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