#include "locmin.h"
#include "bits/stdc++.h"

using namespace std;

std::pair<int, int> find_locmin_point(int n, int m) {
    long long bst = value(1, 1), pi = 1, pj = 1;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            if (i == 1 && j == 1) continue;
            auto x = value(i, j);
            if (x < bst) {
                bst = x;
                pi = i, pj = j;
            }
        }
    }
    return {pi, pj};
}
