#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 7;
const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
const int INFI = 0x3f3f3f3f;
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  long long a, b;
  int TEST;
  cin >> TEST;
  while (TEST--) {
    cin >> a >> b;
    cout << min(a, min(b, (a + b) / 3)) << endl;
  }
}
