#include <iostream>
using namespace std;
int main()
{
	int n,m,i,j,p[100],q[100],x,c;
	bool f = false;
	while (cin >> n >> m && n && m)
	{
		x = n;
		for (i = 0; i < m; i++)
			p[i] = q[i] = 0;
		for (i = 0; i < n; i++)
		{
			for (j = 0; j < m; j++)
			{
				cin >> p[j];
				if (p[j]) q[j]++;
			}
		}
		for (c = 0; c <= m && x >= 0;)
		{
			for (j = 0; j < m; j++)
			{
				if (q[j] == x)
				{
					q[j] = -1;
					cout << j+1;
					f = true;
					break;
				}
			}
			if (!f)
			{
				x--;
			}
			else
			{
				c++;
				if (c >= m) cout << endl;
				else cout << " ";
				f = false;
			}
		}
	}
}