#include <iostream>
using namespace std;
int t, m, n, f[15][15];
int main()
{
for (int i = 1; i <= 10; i++)
{
f[1][i] = 1;
f[0][i] = 1;
f[i][1] = 1;
}
for (int i = 1; i <= 10; i++)
{
for (int j = 2; j <= 10; j++)
{
if (i < j)
f[i][j] = f[i][i];
else
f[i][j] = f[i][j - 1] + f[i - j][j];
}
}
cin >> t;
while (t--)
{
cin >> m >> n;
cout << f[m][n] << '\n';
}
return 0;
}