#include using namespace std; using ll = long long; #define ALL(v) v.begin(),v.end() #define dbg(x) cerr << #x << ": " << (x) << endl; template ostream& operator<<(ostream& os, pair& p) { os << '(' << p.first << ',' << p.second << ')'; return os; } template void print(Iter beg, Iter end) { for (Iter itr = beg; itr != end; ++itr) { cerr << *itr << ' '; } cerr << '\n'; } inline bool naraba(bool a, bool b) { return (!a || b); } int N,M,K; void solve() { cin >> K >> M >> N; int D = gcd(K,M-1); int cnt = K/D/2 * D; if (cnt >= N) { cout << "Yes\n"; int now = 0; vector ans; for (int i = 0; i < K/D/2; ++i) { ans.push_back(now); now = (now + M-1) % K; now = (now + M-1) % K; } for (int i = 0; i < N; ++i) { int x = ans[i % ans.size()] + (i/ans.size()) + 1; cout << x+1 << " \n"[i==N-1]; } } else { cout << "No\n"; } } int main() { int T; cin >> T; while (T--) { solve(); } }