#include <iostream>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
signed main(){
ll n,m;
cin >> n >> m;
vector<pair<ll,ll>> v;
ll cur_min = LLONG_MAX;
for(ll i = 0; i < n; i++)
for(ll j = 0; j < m; j++){
ll x;
cin >> x;
if(x < cur_min){
v.clear();
v.push_back({i,j});
cur_min = x;
}
else if(x == cur_min)
for(auto i: v)
cout << i.first << " " << i.second << "\n";
#include <iostream>
#include <vector>
using namespace std;
#define ll long long
#define ld long double
signed main(){
ll n,m;
cin >> n >> m;
vector<pair<ll,ll>> v;
ll cur_min = LLONG_MAX;
for(ll i = 0; i < n; i++)
for(ll j = 0; j < m; j++){
ll x;
cin >> x;
if(x < cur_min){
v.clear();
v.push_back({i,j});
cur_min = x;
}
else if(x == cur_min)
v.push_back({i,j});
}
for(auto i: v)
cout << i.first << " " << i.second << "\n";
}