#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 9;
const int mod = 1e9 + 7;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int t;
cin >> t;
while(t--){
int n, k;
cin >> n >> k;
int ans = k / 2;
if(k % 2 == 0) ans++;
cout << ans << "\n";
}
return 0;
}