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.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.Comparator;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Random;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author emotionalBlind
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {

    static class Vertex {
        int id;
        List<Vertex> adj = new ArrayList<Vertex>(0);
    }
    int[] val;
    int pos;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int n = in.readInt();
        int m = in.readInt();
        int size = m + n * (m + 1);
        Vertex[] nodes = new Vertex[size];
        for (int i =0; i < size; ++i) {
            nodes[i] = new Vertex();
            nodes[i].id = i;
        }

        val = new int[m];
        int k = m - 1;
        for (int i = 0; i < n; ++i) {
            Integer[] col = new Integer[m];
            for (int j = 0; j < m; ++j) {
                col[j] = j;
            }
            for (int j = 0; j < m; ++j) {
                val[j] = in.readInt();
            }
            Arrays.sort(col, new Comparator<Integer>() {
                @Override
                public int compare(Integer i1, Integer i2) {
                    return val[i1] - val[i2];
                }
            });
            int cur = 0;
            ++k;
            while (cur < m) {
                int next = cur;
                while (next < m && val[col[cur]] == val[col[next]]) {
                    next++;
                }
                if (val[col[cur]] != -1) {
                    for (int u = cur; u < next; ++u) {
                        nodes[k].adj.add(nodes[col[u]]);
                    }
                    ++k;
                    for (int u = cur; u < next; ++u) {
                        nodes[col[u]].adj.add(nodes[k]);
                    }
                }
                cur = next;
            }
        }
        int[] vis = new int[k + 1];
        int[] order = new int[m];
        pos = m - 1;
        boolean valid = true;
        for (int i = 0; i <= k; ++i) {
            if (vis[i] == 0) {
                if (!dfs(nodes[i], vis, order)) {
                    valid = false;
                    break;
                }
            }
        }
        if (!valid) {
            out.printLine(-1);
            return;
        }
        for (int i = 0; i < order.length; ++i) {
            if (i > 0) out.print(" ");
            out.print(order[i] + 1);
        }
    }

    private boolean dfs(Vertex u, int[] vis, int[] order) {
        if (vis[u.id] == 1) {
            return false;
        }
        if (vis[u.id] == 2) {
            return true;
        }
        vis[u.id] = 1;
        for (Vertex v : u.adj) {
            if (!dfs(v, vis, order)) {
                return false;
            }
        }
        vis[u.id] = 2;
        if (u.id < order.length) {
            order[pos] = u.id;
            pos--;
        }
        return true;
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        // InputMismatchException -> UnknownError
        if (numChars == -1)
            throw new UnknownError();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new UnknownError();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        } else if (c == '+') {
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    }

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(outputStream);
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0)
                writer.print(' ');
            writer.print(objects[i]);
        }
    }

    public void printLine(Object...objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }

}