#include <iostream>
#include <fstream>
#include <vector>

using namespace std;

int main()
{
    ifstream in("table.in");
    ofstream out("table.out");
    int n, k;
    in >> n >> k;
    vector<vector<int> > a(n, vector<int>(k));
    for (int i = 0; i < n; i++)
        for (int j = 0; j < k; j++)
            in >> a[i][j];
    vector<vector<int> > whoHasThisJump(n - 1);
    vector<int> howManyJumpsLeft(k);
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = 0; j < k; j++)
        {
            if (a[i][j] > a[i + 1][j])
            {
                whoHasThisJump[i].push_back(j);
                howManyJumpsLeft[j]++;
            }
        }
    }
    vector<bool> used(k);
    vector<int> ans;
    for (int it = 0; it < k; it++)
    {
        int zeroPos = -1;
        for (int j = 0; j < k; j++)
            if (howManyJumpsLeft[j] == 0 && !used[j])
                zeroPos = j;
        if (zeroPos == -1)
        {
            out << "-1\n";
            return 0;
        }
        ans.push_back(zeroPos);
        used[zeroPos] = true;
        for (int i = 0; i < n - 1; i++)
        {
            if (a[i][zeroPos] != a[i + 1][zeroPos])
            {
                for (size_t q = 0; q < whoHasThisJump[i].size(); q++)
                {
                    int ind = whoHasThisJump[i][q];
                    howManyJumpsLeft[ind]--;
                }
                whoHasThisJump[i].clear();
            }
        }
    }
    for (int i = 0; i < k; i++)
        out << ans[i] + 1 << " ";
    out << "\n";
}
