#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long i, j, n, k;
    vector<long long> z;
    long long p, q, r;
    string s;
    map<long long, long long> mp;
    cin >> n >> k;
    n -= (n - 1) / 2;
    cout << k / n << "\n";
  }
}
