import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args:Array[String]) = {
    val b = new ArrayBuffer[String]
    var s = "0 0"
    while({s = readLine.trim;s} != "0 0") {
      val n = s.split(" ").map(_.toInt)
      val sum = {
        for(i<-1 to n(0)) yield readLine.split(" ").map(_.toInt).toList
      }.toList.transpose.map(_.sum)
        .zipWithIndex
        .sortWith((x,y) => (x._1 > y._1) || (x._1==y._1 && x._2<y._2))
        .map(_._2+1)
      b+=sum.mkString(" ")
    }
    println(b.mkString("\n"))
  }
}