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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.ArrayDeque;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author prakharjain
 */
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);
        _247D solver = new _247D();
        solver.solve(1, in, out);
        out.close();
    }

    static class _247D {
        Set[] g;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            int 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();
                }
            }

            g = new Set[n * m + m];

            for (int i = 0; i < n * m + m; i++) {
                g[i] = new HashSet();
            }

            int nc = m;

            for (int i = 0; i < n; i++) {
                List<num> nums = new ArrayList<>();

                for (int j = 0; j < m; j++) {
                    nums.add(new num(j, a[i][j]));
                }

                nums.sort((n1, n2) -> n1.num - n2.num);

                int j = 0;
                while (j < m && nums.get(j).num == -1) {
                    j++;
                }

                int[] next = new int[m];

                next[m - 1] = m;
                for (int k = m - 2; k >= j; k--) {
                    if (nums.get(k).num < nums.get(k + 1).num) {
                        next[k] = k + 1;
                    } else {
                        next[k] = next[k + 1];
                    }
                }

                int pn = -1;
                for (int k = j; k < m; k++) {
                    int l = k;

                    while (l < m - 1 && nums.get(l + 1).num == nums.get(l).num) {
                        l++;
                    }

                    if (l > k) {
                        if (pn != -1) {
                            for (int o = k; o <= l; o++) {
                                g[pn].add(nums.get(o).i);
                            }
                        }
                        if (l < m - 1) {
                            for (int o = k; o <= l; o++) {
                                g[nums.get(o).i].add(nc);
                            }
                            pn = nc;
                            nc++;
                        }
                    } else {
                        if (pn != -1) {
                            g[pn].add(nums.get(l).i);
                        }
                        pn = nums.get(l).i;
                    }

                    k = l;
                }

//            for (; j < m; j++) {
//                num cn = nums.get(j);
//                if (next[j] < m) {
//                    num nn = nums.get(next[j]);
//                    g[cn.i].add(nn.i);
//                }
//            }
            }

            CycleFinder cycle = new CycleFinder(g, nc);

            if (cycle.isCycleDirected()) {
                out.println(-1);
                return;
            }

            TopoSort topoSort = new TopoSort(nc, m, g);
            topoSort.topoSort();

            List<Integer> topo = topoSort.topoOrder;

            for (int i = 0; i < topo.size(); i++) {
                out.print((topo.get(i) + 1) + " ");
            }

        }

        class num {
            int i;
            int num;

            public num(int i, int num) {
                this.i = i;
                this.num = num;
            }

        }

        class TopoSort {
            int n;
            Set[] g;
            int m;
            List<Integer> topoOrder = new ArrayList<>();

            public TopoSort(int n, int m, Set[] g) {
                this.n = n;
                this.g = g;
                this.m = m;
            }

            void topoSort() {

                int[] in = new int[n];

                ArrayDeque<Integer> q = new ArrayDeque<>();

                for (int i = 0; i < n; i++) {
                    for (int v : (Set<Integer>) g[i]) {
                        in[v]++;
                    }
                }

                for (int i = 0; i < n; i++) {
                    if (in[i] == 0) {
                        q.addLast(i);
                    }
                }

                while (!q.isEmpty()) {
                    int ce = q.removeFirst();

                    if (ce < m)
                        topoOrder.add(ce);
                    for (int v : (Set<Integer>) g[ce]) {
                        in[v]--;

                        if (in[v] == 0) {
                            q.addLast(v);
                        }
                    }
                }
            }

        }

        class CycleFinder {
            Set[] g;
            int n;
            boolean isCycle;
            boolean[] recstack;
            boolean[] vis;

            public CycleFinder(Set[] g, int n) {
                this.g = g;
                this.n = n;
                this.recstack = new boolean[n];
                this.vis = new boolean[n];
            }

            boolean isCycleDirected() {
                isCycle = false;


                for (int i = 0; i < n; i++) {
                    if (!vis[i]) {
                        dfs(i);
                    }
                }

                return isCycle;
            }

            private void dfs(int u) {
                recstack[u] = true;

                vis[u] = true;

                for (int v : (Set<Integer>) g[u]) {
                    if (recstack[v]) {
                        isCycle = true;
                    }
                    if (!vis[v]) {
                        dfs(v);
                    }
                }

                recstack[u] = false;
            }

        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(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 close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

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

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

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

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                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 boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}