#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, s;
  cin >> n >> s;
  if (n == 1) {
    cout << s;
    return;
  }
  int m = (n + 1) / 2;
  if (s < 0) {
    cout << 0;
    return;
  }
  int ans = s / (n - m + 1);
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  ;
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << endl;
  }
  return 0;
}
