#include <bits/stdc++.h>
using namespace std;
void fac(long long p) {
  long long f = 1;
  for (int i = 2; i <= p; i++) {
    f *= i;
  }
  cout << f << endl;
  return;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    long long s;
    cin >> s;
    long long ans = 0;
    if (n % 2 == 0) {
      long long m = n / 2;
      long long d = n - m + 1;
      ans = s / d;
    } else {
      long long m = n / 2 + 1;
      ans = s / m;
    }
    cout << ans << endl;
  }
}
