void main() {int mas[MAX][MAX], n, m, i, j, k, ok; scanf("%d%d", &n, &m); for (i=0; i<n; ++i) for (j=0; j<m; ++j) scanf("%d", &mas[i][j]); for (i=0; i<n; ++i) for (j=i+1; j<n; ++j) {ok=1; for (k=0; k<m; ++k) if (mas[i][k]==mas[j][k]) {ok=0; break;} if (ok) printf("%d %d\n", i, j);}}
#define MAX 100
void main()
{int mas[MAX][MAX], n, m, i, j, k, ok;
scanf("%d%d", &n, &m);
for (i=0; i<n; ++i)
for (j=0; j<m; ++j)
scanf("%d", &mas[i][j]);
for (i=0; i<n; ++i)
for (j=i+1; j<n; ++j)
{ok=1;
for (k=0; k<m; ++k)
if (mas[i][k]==mas[j][k])
{ok=0;
break;}
if (ok)
printf("%d %d\n", i, j);}}