#include <iostream>
using namespace std;
int a, b, c,b2;
long long d=1;
int main()
{
cin >> a;
while (a--)
{
cin >> b >> c;
b2 = b;
for (b; b > c; b--)
{
d = d * b;
}
for (int j=1; j <= (b2-c); j++)
{
d = d / j;
}
cout << d<<endl;
d = 1;
}
}