QOJ.ac

QOJ

Time Limit: 2.0 s Memory Limit: 256 MB Total points: 100 Hackable ✓

# 11536. Scoreboard Screenshots

统计

The MITIT 2025 Winter Contest has successfully ended with the participation of $K$ teams, and Busy Beaver has to write a report for the contest.

problem_11536_1.jpg

For the report, Busy Beaver took $N$ screenshots of the scoreboard during the contest. Each screenshot contains the scores of all $K$ teams when the screenshot was taken.

Unfortunately, Busy Beaver forgot in which order he took the screenshots! He assumes that if there were no regrades during the contest, each team's score will be nondecreasing over time. Under this assumption, Busy Beaver wants to recover the order of the screenshots.

Determine if there is a valid ordering such that no team's score ever decreases over time, and if it exists, print any such order.

Input

The first line contains two integers $N$ and $K$ ($2 \leq N \leq 400$; $1 \leq K \leq 400$) --- the number of screenshots and teams.

The $i$-th of the next $N$ lines contains $K$ integers $a_{i,1}, a_{i,2}, \dots, a_{i,k}$ ($0 \leq a_{i,j} \leq 900$), where $a_{i, j}$ is the score of the $j$-th team in the $i$-th screenshot.

Output

If a valid ordering exists, print YES (without quotes) on the first line. On the second line, print $N$ integers $b_1, \dots, b_N$, where $b_i$ is the index of the $i$-th screenshot in the valid ordering. If there are multiple solutions, you can print any of them.

If there is no valid ordering, print NO (without quotes).

Scoring

There are two subtasks for this problem.

  • ($20$ points) $K = 1$.
  • ($80$ points) No additional constraints.

Example

Input

3 2
1 1
0 0
0 1

Output

YES
2 3 1

Explanation

In the first test case, a valid ordering of the screenshots is:

  • Second screenshot: Team $1$ has score $0$, and Team $2$ has score $0$.
  • Third screenshot: Team $1$ has score $0$, and Team $2$ has score $1$.
  • First screenshot: Team $1$ has score $1$, and Team $2$ has score $1$.

Input

3 3
0 0 1
1 0 0
0 1 0

Output

NO

Explanation

In the second test case, no valid ordering exists because it is impossible to arrange the screenshots so that all scores for each team are nondecreasing over time.