P3013 [USACO11FEB] The Lost Cows G
Description
One sunny day farmer John was kidnapped by evil farmer Marcus's cows. FJ wasn't too concerned about his forced holiday but wanted to make sure that his cows got home safely together.
The cows are spread out in every one of FJ's N (3
Input Format
\* Line 1: Two space separated integers: N and M
\* Lines 2..M+1: Line i+1 describes the contents of each pasture's N signs with N integers: S\_1i..S\_Ni
Output Format
\* Lines 1..?: The sign numbers the cows should follow, one per line.