print(a)
a_1d = a.flatten()
idx_1d = a_1d.argsort()[-N:]
x_idx, y_idx = np.unravel_index(idx_1d, a.shape)
for x, y in zip(x_idx, y_idx):
    pass
how to get the index of the largest n values in a multi-dimensional numpy array