
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define MP make_pair
#define UM unordered_map
#define lson root<<1,l,midd
#define rson root<<1|1,midd+1,r
#define lc root<<1
#define rc root<<1|1
typedef long long ll;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
const ll INF=1e18;
#define pi 3.1415926535898
#define DEC (pi/180)
const int M=1e6+5;
int f[M];
int Find(int u){
    return f[u]==u?u:f[u]=Find(f[u]);
}
void pn(){
    puts("NO");
}
void py(){
    puts("YES");
}
ll ksm(ll x,ll y){
    ll t=1;
    while(y){
        if(y&1)
            t=t*x%mod;
        y>>=1;
        x=x*x%mod;
    }
    return t;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int T;
	cin>>T;
	while(T--){
        int n,m;
        cin>>n>>m;
        if(m<n){
            int x=n/m;
            x=x*m;
            if(x<n)
                x+=m;
            m=x;
        }
        int chu=m/n,yu=m%n;
        if(yu>=1) chu++;
        cout<<chu<<endl;

	}
	return 0;
}
