P5271 OwenOwl Does Not Learn Driving and Does Not Delete Repos
Background
mcfx and ComeIntoPower like to make up problem backgrounds when they are bored. OwenOwl asked “buddy” zcysky why they did this, and “buddy” zcysky replied like this:

OwenOwl felt very upset, so one day he found J, and asked J to create 20010910 pointers to point the three of them to Azerbaijan to keep sunset company there.
While the three of them were touring Azerbaijan, OwenOwl smashed the car, and the repository was restored.
However, since mcfx and ComeIntoPower had previously posted too many nasty problems using the ID OwenOwl, OwenOwl’s reputation had already been damaged. To prove that the nasty ones were those two and not himself, OwenOwl made an easy “sign-in” problem.
Description
Let $p$ be a prime number.
You are given an undirected complete graph with $p^k$ vertices (there is an undirected edge between any two vertices). The vertices are labeled from $0$ to $p^k-1$.
Now you need to find some complete subgraphs on $p$ vertices such that every edge in the original graph belongs to one and only one of these complete subgraphs.
Obviously, the number of complete subgraphs you need to find is $\frac{p^k(p^k-1)/2}{p(p-1)/2}$. You can see that this expression is always an integer.
Input Format
One line containing two positive integers $p, k$.
Output Format
If there is no solution, output one line `NO`.
Otherwise, output one line `YES`, then output $\frac{p^k(p^k-1)/2}{p(p-1)/2}$ lines. Each line contains $p$ numbers, representing the vertex labels of one complete subgraph you found.
You may output any valid solution in any order.
Explanation/Hint
For $10\%$ of the testdata, $k \le 1$.
For $50\%$ of the testdata, $k \le 2$.
Another $20\%$ of the testdata has $p = 2$.
For $100\%$ of the testdata, $k$ is a positive integer, $p$ is prime, and $2 \le p^k \le 2000$.
In addition, the total output size is guaranteed not to exceed 2MB, but you should still pay attention to the time spent on output.
Translated by ChatGPT 5