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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
FILE *file_in = stdin, *file_out = stdout;
struct NORMAL_IN {
  bool cnt;
  NORMAL_IN() : cnt(true) {}
  operator int() const { return cnt; }
  NORMAL_IN &operator>>(int &n) {
    cnt = fscanf(file_in, "%d", &n) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(unsigned int &n) {
    cnt = fscanf(file_in, "%u", &n) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(long long &n) {
    cnt = fscanf(file_in, "%lld", &n) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(unsigned long long &n) {
    cnt = fscanf(file_in, "%llu", &n) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(double &n) {
    cnt = fscanf(file_in, "%lf", &n) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(long double &n) {
    cnt = fscanf(file_in, "%Lf", &n) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(char *c) {
    cnt = fscanf(file_in, "%s", c) != EOF;
    return *this;
  }
  NORMAL_IN &operator>>(string &s) {
    s.clear();
    for (bool r = false;;) {
      const char c = getchar();
      if (c == EOF) {
        cnt = false;
        break;
      }
      const int t = isspace(c);
      if (!r and !t) r = true;
      if (r) {
        if (!t)
          s.push_back(c);
        else
          break;
      }
    }
    return *this;
  }
  template <class T>
  NORMAL_IN &operator>>(vector<T> &v) {
    int n;
    fscanf(file_in, "%d", &n);
    for (int i = 0; i < (int)(n); ++i) {
      T t;
      *this >> t;
      v.push_back(t);
    }
  }
} normal_in;
struct NORMAL_OUT {
  NORMAL_OUT &operator<<(const int &n) {
    fprintf(file_out, "%d", n);
    return *this;
  }
  NORMAL_OUT &operator<<(const unsigned int &n) {
    fprintf(file_out, "%u", n);
    return *this;
  }
  NORMAL_OUT &operator<<(const long long &n) {
    fprintf(file_out, "%lld", n);
    return *this;
  }
  NORMAL_OUT &operator<<(const unsigned long long &n) {
    fprintf(file_out, "%llu", n);
    return *this;
  }
  NORMAL_OUT &operator<<(const double &n) {
    fprintf(file_out, "%lf", n);
    return *this;
  }
  NORMAL_OUT &operator<<(const long double &n) {
    fprintf(file_out, "%Lf", n);
    return *this;
  }
  NORMAL_OUT &operator<<(const char c[]) {
    fprintf(file_out, "%s", c);
    return *this;
  }
  NORMAL_OUT &operator<<(const string &s) {
    fprintf(file_out, "%s", s.c_str());
    return *this;
  }
} normal_out;
struct Edge {
  int src, dst, rev;
  int weight;
  Edge(int src, int dst, int weight = 1, int rev = -1)
      : src(src), dst(dst), weight(weight), rev(rev) {}
};
bool operator<(const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight
         : e.src != f.src     ? e.src < f.src
                              : e.dst < f.dst;
}
struct Graph : vector<vector<Edge> > {
  Graph() {}
  Graph(const int &n) { this->assign(n, vector<Edge>()); }
  void addBiEdge(int from, int to, int w = 1) {
    while (this->size() < max(from, to) + 1) this->push_back(vector<Edge>());
    this->at(from).push_back(Edge(from, to, w, this->at(to).size()));
    this->at(to).push_back(Edge(to, from, w, this->at(from).size() - 1));
  }
  void addEdge(int from, int to, int w = 1) {
    while (this->size() < from + 1) this->push_back(vector<Edge>());
    this->at(from).push_back(Edge(from, to, w));
  }
};
bool visit(const Graph &g, int v, vector<int> &order, vector<int> &color,
           vector<int> &next) {
  color[v] = 1;
  for (__typeof((g[v]).begin()) e = (g[v]).begin(); e != (g[v]).end(); ++e) {
    if (color[e->dst] == 2) continue;
    if (color[e->dst] == 1) {
      order.clear();
      int t = e->dst;
      while (1) {
        order.push_back(t);
        if (t == v) break;
        t = next[t];
      }
      return false;
    }
    next[v] = e->dst;
    if (!visit(g, e->dst, order, color, next)) return false;
    next[v] = -1;
  }
  order.push_back(v);
  color[v] = 2;
  return true;
}
bool topologicalSort(const Graph &g, vector<int> &order) {
  int n = g.size();
  vector<int> color(n), next(n, -1);
  for (int u = 0; u < (int)(n); ++u)
    if (!color[u] && !visit(g, u, order, color, next)) return false;
  reverse((order).begin(), (order).end());
  return true;
}
int n, m;
int main() {
  normal_in >> n >> m;
  vector<vector<int> > a(n, vector<int>(m));
  for (int i = 0; i < (int)(n); ++i)
    for (int j = 0; j < (int)(m); ++j) normal_in >> a[i][j];
  vector<vector<pair<int, pair<int, int> > > > v(n);
  int t = m;
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = 0; j < (int)(m); ++j)
      if (a[i][j] != -1) {
        v[i].push_back({a[i][j], {-1, -1}});
      }
    sort((v[i]).begin(), (v[i]).end());
    v[i].erase(unique((v[i]).begin(), (v[i]).end()), v[i].end());
    int prev = t++;
    for (int j = 0; j < v[i].size(); j++) {
      int next = t++;
      v[i][j].second = {prev, next};
      prev = next;
    }
  }
  Graph G(t);
  for (int j = 0; j < (int)(m); ++j) {
    for (int i = 0; i < (int)(n); ++i) {
      if (a[i][j] == -1) continue;
      auto it = lower_bound((v[i]).begin(), (v[i]).end(),
                            make_pair(a[i][j], make_pair(-1, -1)));
      assert(it->first == a[i][j]);
      int prev = it->second.first;
      int next = it->second.second;
      G.addEdge(prev, j);
      G.addEdge(j, next);
    }
  }
  vector<int> order;
  if (topologicalSort(G, order)) {
    for (int i = 0; i < (int)(order.size()); ++i) {
      if (order[i] >= m) continue;
      normal_out << order[i] + 1 << " ";
    }
    normal_out << "\n";
  } else {
    normal_out << -1 << "\n";
  }
}