object Main extends App {
  val src = io.Source.stdin.getLines.map(_.split(" ").map(_.toInt).toList)

  for (List(rows, elems) <- src if rows != 0)
    println(src.take(rows).toList
      .transpose.map(_.sum).zip(Stream from 1)
      .sortWith((tup1, tup2) => tup1._1 > tup2._1)
      .unzip._2.mkString(" "))
}

