#include #include using namespace std; int main(){ int T,n,m; scanf("%d",&T); while (T--){ int ans=0; scanf("%d%d",&n,&m); while (m){ if (m