import sys input = sys.stdin.readline from math import log logs = [-1] for i in range(1, 10**5+10): logs.append(log(i)) acc = [0] for logs_i in logs: acc.append(acc[-1]+logs_i) for _ in range(int(input())): N, M, K = map(int, input().split()) F = log(M)+acc[N+1]-acc[N-K+1]-(acc[K+1]-acc[1]) S = log(N-K+1)+K*log(M) if F