import java.math.*;
import java.util.*;
import java.io.*;
 
public class jokes_aa_java implements Runnable {
 
    public BufferedReader in;
    public StringTokenizer stoken = new StringTokenizer("");
    public PrintWriter out;
 
    public static void main(String[] args) throws IOException {
    	new Thread(null, new jokes_aa_java(), "", (1 << 25)).start();
    }   
    
    int k;
    
    public void run() {
    	try {
            long t1 = System.currentTimeMillis();
    		in = new BufferedReader(new InputStreamReader(System.in));
    		out = new PrintWriter(System.out);
    		solve();
            System.err.println("Time = " + (System.currentTimeMillis() - t1));
    	} catch (Exception e) {
    		throw new RuntimeException(e);
    	} finally {
    		out.close();
    	}
    }
        
        private void solve() throws IOException{
            int n = nextInt();
            k = nextInt();
            Joke[] a = new Joke[n];
            for (int i = 0; i < n; i++) {
            	a[i] = new Joke(i + 1);
            	for (int j = 0; j < k; j++)
            		a[i].a[j] = nextInt();
            }
            Arrays.sort(a);
            for (int i = 0; i < n; i++)
            	out.print(a[i].n + " ");
        }
     
        private int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(nextString());
        }
     
        private long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(nextString());
        }
     
        private String nextString() throws IOException {
            while(!stoken.hasMoreTokens()){
                String st = in.readLine();
                stoken = new StringTokenizer(st);
            }
            return stoken.nextToken();
        }
        
        class Joke implements Comparable<Joke> {
        	  int[] a;
        	  int n;
        	  
        	  public Joke(int n) {
        	    this.a = new int[15];
        	    this.n = n;
        	  }
        	  
        	  @Override
        	  public int compareTo(Joke other) {
        	    for (int i = 0; i < k; i++)
        	    	if (a[i] < other.a[i]) return 1; else
        	    	if (a[i] > other.a[i]) return -1;
        	    return 0;
        	  }
        }
     
    }  