Problem: Lenny had an n × m matrix of positive integers. He loved the matrix so much, because each row of the matrix was sorted in non-decreasing order. For the same reason he calls such matrices of integers lovely.

One day when Lenny was at school his little brother was playing with Lenny's matrix in his room. He erased some of the entries of the matrix and changed the order of some of its columns. When Lenny got back home he was very upset. Now Lenny wants to recover his matrix.

Help him to find an order for the columns of the matrix so that it's possible to fill in the erased entries of the matrix to achieve a lovely matrix again. Note, that you can fill the erased entries of the matrix with any integers.

Input

The first line of the input contains two positive integers n and m (1 ≤ n·m ≤ 105). Each of the next n lines contains m space-separated integers representing the matrix. An integer -1 shows an erased entry of the matrix. All other integers (each of them is between 0 and 109 inclusive) represent filled entries.

Output

If there exists no possible reordering of the columns print -1. Otherwise the output should contain m integers p1, p2, ..., pm showing the sought permutation of columns. So, the first column of the lovely matrix will be p1-th column of the initial matrix, the second column of the lovely matrix will be p2-th column of the initial matrix and so on.

Examples

Input

3 3
1 -1 -1
1 2 1
2 -1 1


Output

3 1 2 


Input

2 3
1 2 2
2 5 4


Output

1 3 2 


Input

2 3
1 2 3
3 2 1


Output

-1

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.Locale;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					new Main().run();
					System.err.println("Memory status: " + memoryStatus());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
		in.close();
	}

	private void solve() throws IOException {
		int n = ni();
		int m = ni();
		ColumnPrioritizer.totalBigs = new int[m];
		Arrays.fill(ColumnPrioritizer.totalBigs, n);
		ColumnPrioritizer.next = new TreeSet<Integer>(
				new Comparator<Integer>() {

					@Override
					public int compare(Integer o1, Integer o2) {
						if (ColumnPrioritizer.totalBigs[o1] != ColumnPrioritizer.totalBigs[o2])
							return ColumnPrioritizer.totalBigs[o1]
									- ColumnPrioritizer.totalBigs[o2];
						return o1-o2;
					}

				});
		for (int i = 0; i < m; i++)
			ColumnPrioritizer.next.add(i);

		ColumnPrioritizer[] p = new ColumnPrioritizer[n];
		for (int i = 0; i < n; i++)
			p[i] = new ColumnPrioritizer(nia(m));
		int[] ret = new int[m];
		Arrays.fill(ret, -1);
		int index = 0;
		while (left(p) != 0) {
			int remove = ColumnPrioritizer.next.pollFirst();
			if (ColumnPrioritizer.totalBigs[remove] != 0) {
				out.println(-1);
				return;
			}
			for (int i = 0; i < n; i++)
				p[i].remove(remove);
			ret[index++] = remove + 1;
		}
		for (int i = 0; i < m; i++)
			if (ret[i] == -1)
				ret[i] = 1 + index++;
		 printArray(ret);
	}

	private int left(ColumnPrioritizer[] p) {
		int ret = 0;
		for (ColumnPrioritizer a : p)
			ret += a.size();
		return ret;
	}

	private static class ColumnPrioritizer {
		public static int[] totalBigs;
		public static TreeSet<Integer> next;

		private int[] value;
		private Integer[] cols;
		private boolean[] smalls;
		private int m;
		private int index;
		private int totalSmalls;

		public ColumnPrioritizer(final int[] value) {
			m = value.length;
			this.value = value;
			cols = new Integer[m];
			for (int i = 0; i < m; i++)
				cols[i] = i;
			Arrays.sort(cols, new Comparator<Integer>() {

				@Override
				public int compare(Integer a, Integer b) {
					return value[a] - value[b];
				}

			});
			smalls = new boolean[m];
			index = 0;
			while (index < m && value[cols[index]] == -1) {
				int c = cols[index];
				next.remove(c);
				totalBigs[c]--;
				next.add(c);
				index++;
			}
			update();
		}

		private void update() {
			if (index == m)
				return;
			int curr = value[cols[index]];
			while (index < m && value[cols[index]] == curr) {
				int c = cols[index];
				next.remove(c);
				totalBigs[c]--;
				next.add(c);
				smalls[c] = true;
				totalSmalls++;
				index++;
			}
		}

		public void remove(int c) {
			if (smalls[c]) {
				smalls[c] = false;
				totalSmalls--;
				if (totalSmalls == 0)
					update();
			}

		}

		public int size() {
			return m - index + totalSmalls;
		}

		public boolean isEmpty() {
			return size() == 0;
		}

	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nl() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nd() throws IOException {
		return Double.parseDouble(nextToken());
	}

	int[] nia(int size) throws IOException {
		int[] ret = new int[size];
		for (int i = 0; i < size; i++)
			ret[i] = ni();
		return ret;
	}

	long[] nla(int size) throws IOException {
		long[] ret = new long[size];
		for (int i = 0; i < size; i++)
			ret[i] = nl();
		return ret;
	}

	double[] nda(int size) throws IOException {
		double[] ret = new double[size];
		for (int i = 0; i < size; i++)
			ret[i] = nd();
		return ret;
	}

	String nextLine() throws IOException {
		st = new StringTokenizer("");
		return in.readLine();
	}

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0)
				out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank)
				out.print(' ');
			else
				blank = true;
			out.print(x);
		}
		out.println();
	}

	static String memoryStatus() {
		return (Runtime.getRuntime().totalMemory()
				- Runtime.getRuntime().freeMemory() >> 20)
				+ "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB";
	}
}