#include<iostream>
using namespace std;
int tohop(int n, int k)
{
    if(k == 0 || k == n)
        return 1;
    return tohop(n-1, k-1) + tohop(n-1, k);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t;
    cin >> t;
    while(t--)
    {
        int n, k;
        cin >> n >> k;
        if(k > n)
            cout << -1;
        else
            cout << tohop(n,k);
        cout << "\n";
    }
}