#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int t = 1;
  cin >> t;
  while (t--) {
    long long int a, b;
    cin >> a >> b;
    if (a < b) swap(a, b);
    if (a == 0 || b == 0) {
      cout << 0 << endl;
      continue;
    }
    if (2 * b <= a) {
      cout << b << endl;
      continue;
    }
    cout << (a + b) / 3 << endl;
  }
  return 0;
}
