import java.io.*;
import java.util.*;

public class table_av {

	FastScanner in;
	PrintWriter out;
	final String fileName = "table".toLowerCase();

	int[] solve(int[][] a) {
		int n = a.length, m = a[0].length;

		int[] countFalls = new int[m];
		for (int j = 0; j < m; j++) {
			for (int i = 0; i < n - 1; i++) {
				if (a[i][j] > a[i + 1][j]) {
					countFalls[j]++;
				}
			}
		}

		int[] eqClass = new int[n];
		int[] ans = new int[m];

		for (int col = 0; col < m; col++) {
			int goodCol = -1;
			for (int j = 0; j < m; j++) {
				if (countFalls[j] == 0) {
					goodCol = j;
					break;
				}
			}

			if (goodCol == -1) {
				return null;
			}
			ans[col] = goodCol;
			countFalls[goodCol] = Integer.MAX_VALUE;

			int classes = 0;
			int[] newClass = new int[n];
			eqClass[0] = 0;
			for (int i = 1; i < n; i++) {
				if (eqClass[i] == eqClass[i - 1]
						&& a[i][goodCol] == a[i - 1][goodCol]) {
					newClass[i] = classes;
					continue;
				} else {
					if (eqClass[i] == eqClass[i - 1]) {
						for (int j = 0; j < m; j++) {
							if (a[i - 1][j] > a[i][j]) {
								countFalls[j]--;
							}
						}
					}

					classes++;
					newClass[i] = classes;
				}
			}
			
			eqClass = newClass;
		}

		return ans;
	}

	void run() {
		try {
			in = new FastScanner(fileName + ".in");
			out = new PrintWriter(fileName + ".out");
			int n = in.nextInt(), m = in.nextInt();
			int[][] a = new int[n][m];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					a[i][j] = in.nextInt();
				}
			}
			int[] perm = solve(a);
			if (perm == null) {
				out.println(-1);
			} else {
				for (int i = 0; i < m; i++) {
					out.print(perm[i] + 1);
					if (i + 1 == m) {
						out.println();
					} else {
						out.print(" ");
					}
				}
			}
			out.close();

		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] args) {
		new table_av().run();
	}
}
