def gcd(a, b): while a != 0: b %= a if b == 0: return a a %= b return b def solve(): K,M,N = map(int,input().split()) if K < 2 * N: print('No') return M -= 1 if M == 0: print('No') return g = gcd(M,K) k = K // g res = (k // 2) * g if res < N: print('No') return print('Yes') seen = [0] * K G = [] for k in range(K): u = k if seen[u]: continue G.append([]) while seen[u] == 0: seen[u] = 1 G[-1].append(u) u = (u + M) % K A = [] B = [] for g in G: for i in range(len(g) // 2): a,b = g[2 * i],g[2 * i + 1] A.append(a + 1) B.append(b + 1) A = A[:N] B = B[:N] print(*A) return for _ in range(int(input())): solve()