{-#LANGUAGE BangPatterns#-}
module Main where

import Data.Functor
import Control.Monad
import Data.List

main::IO ()
main=do
   (m:n:_)<- map read . words <$> getLine::IO [Int]
   unless (m==0 && n==0) $
     do
       input<-replicateM m (map read . words <$> getLine)::IO [[Int]]
       let input'=zip [1..] (map (length . filter (==1)) $ cross input n)::[(Int,Int)]
           out=unwords . map (show . fst) $ sortBy func input'
       putStrLn out
       main
  where
    func (_,a) (_,b)=case compare a b of
      LT->GT
      EQ->EQ
      GT->LT

cross::[[a]]->Int->[[a]]
cross list n=reverse $ cross' [] list n
  where
    cross'::[[a]]->[[a]]->Int->[[a]]
    cross' v l 0=v
    cross' v l !m=
      let (xs,xss)=(map head l,map tail l) in
      cross' (xs:v) xss (m-1)