Under construction

Still being built. Things may change

Scoreboard Screenshots

Interview

Time limit2sMemory limit256 MB

Summary
Given N scoreboard screenshots of K teams, find an order in which every team's score never decreases, or report NO if none exists.
Level

Easy3 of 10

Topics
Sorting, Array, Implementation
Solved
No attempts yet

Problem

The MITIT 2025 Winter Contest has ended with KK teams participating, and Busy Beaver has to write a report on the contest.

For the report, Busy Beaver took NN screenshots of the scoreboard during the contest. Each screenshot shows the scores of all KK teams at the moment it was taken.

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

Determine whether a valid ordering exists in which no team's score decreases over time. If one exists, print any such ordering.

Input

The first line contains two integers NN and KK (2≤N≤4002\leq N\leq 400; 1≤K≤4001\leq K\leq 400), the number of screenshots and the number of teams.

The ii-th of the next NN lines contains KK integers ai,1,ai,2,⋯ ,ai,Ka_{i,1}, a_{i,2}, \cdots, a_{i,K} (0≤ai,j≤9000\leq a_{i,j}\leq 900), where ai,ja_{i,j} is the score of the jj-th team in the ii-th screenshot.

Output

If a valid ordering exists, print YES on the first line. On the second line, print NN integers b1,⋯ ,bNb_1, \cdots, b_N, where bib_i is the index of the screenshot placed at position ii in the ordering. If there are multiple solutions, you can print any of them.

If no valid ordering exists, print NO.

Examples2

  1. Example 1

    Input
    3 2
    1 1
    0 0
    0 1
    
    Expected output
    YES
    2 3 1
    
  2. Example 2

    Input
    3 3
    0 0 1
    1 0 0
    0 1 0
    
    Expected output
    NO