#include "testlib.h"

using namespace std;

int const MAX_T = 2000;
int const MAX_N = 2000;

int main(int argc, char **argv) {
  registerValidation(argc, argv);
  int tests = inf.readInt(1, MAX_T, "t");
  inf.readEoln();
  for (int i = 1; i <= tests; i++) {
    setTestCase(i);
    int n = inf.readInt(1, MAX_N, "n");
    inf.readSpace();
    int k = inf.readInt(1, n, "k");
    inf.readSpace();
    int d = inf.readInt(1, MAX_N, "d");
    inf.readEoln();
  }
  inf.readEof();
  return 0;
}