#include<bits/stdc++.h>
using namespace std;
int binomialCoeff(int n, int k);
int main()
{
int t;
cin>>t;
int n,k;
while(t--)
{
cin>>n>>k;
if(n==k)
{
cout<<1<<endl;
}
else
{
cout<<binomialCoeff(n-1, k-1)<<endl;
}
}
}
int binomialCoeff(int n, int k)
{
// Base Cases
if (k > n)
return 0;
if (k == 0 || k == n)
return 1;
// Recur
return binomialCoeff(n - 1, k - 1)
+ binomialCoeff(n - 1, k);
}