package work;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class A1644 {
static int T;
static int K;
public static void main(String args[]) throws FileNotFoundException{
Scanner sc=new Scanner(new File("src/1644.txt"));
T=sc.nextInt();
for(int t=0;t<T;t++){
int M=sc.nextInt();
int N=sc.nextInt();
System.out.println(fun(M,N));
}
}
public static int fun(int m,int n) {
if (m < 0) {
return 0;
}
if (m == 0) {
return 1;
}
if (n == 1) {
return 1;
}
return K=fun(m,n-1)+fun(m-n,n);
// TODO Auto-generated method stub
}
}
//
1
7 3
//
8