#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433;
const int mod = 1000000007;
const long long inf = 3e18;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    if (a > b) swap(a, b);
    if (b >= 2 * a)
      cout << a << "\n";
    else
      cout << (a + b) / 3 << "\n";
  }
}
