using System;
using System.Text;
using System.IO;
namespace _2775
{
class Program
{
static void Main()
{
StreamReader sr = new StreamReader(Console.OpenStandardInput());
StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());
StringBuilder sb = new StringBuilder();
int t = int.Parse(sr.ReadLine());
for(int i = 0; i < t; i++)
{
int k = int.Parse(sr.ReadLine());
int n = int.Parse(sr.ReadLine());
int[,] apt = new int[k+1, n];
for(int j = 0; j <= k; j++)
{
apt[j, 0] = 1;
}
for(int j = 1; j < n; j++)
{
apt[0, j] = j+1;
}
for(int kIndex=1; kIndex<=k; kIndex++)
{
for(int nIndex=1; nIndex<n; nIndex++)
{
apt[kIndex, nIndex] = apt[kIndex-1, nIndex] + apt[kIndex, nIndex - 1];
}
}
sb.Append(apt[k, n-1]);
sb.Append("\n");
}
sw.WriteLine(sb);
sr.Close();
sw.Flush();
sw.Close();
}
}
}