#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization("unroll-loops")
#include <bits/stdc++.h>
#define Code ios_base::sync_with_stdio(false);
#define by cin.tie(NULL);
#define black_heretic cout.tie(NULL);
#define fl(n) for (int i = 0; i < n; i++)
#define rl(m, n) for (int i = n; i >= m; i--)
typedef long long ll;
#define read(x) ll x; cin >> x
using namespace std;
void solve() {
int i, j, n, m;
cin >> m >> n;
int arr[m][n];
vector<pair<int, int>> cordinates;
for(i = 0; i < m; ++i){
for(j = 0; j < n; ++j){
cin >> arr[i][j];
if(arr[i][j] == 1){
cordinates.push_back(make_pair(i, j));
}
}
}
for (auto it = cordinates.begin(); it!=cordinates.end(); ++it) {
cout << it->first << " " << it->second << endl;
}
return;
}
signed main(){
Code by black_heretic
solve();
return 0;
}