# Import the NumPy library
import numpy as np
arr = np.array([[5, 6, 2], [4, 1, 3], [7, 9, 8]])

# sort by the second column (index 1), then by the first column (index 0)
sorted_indices = np.lexsort((arr[:,0], arr[:,1]))
sorted_arr = arr[sorted_indices]

print(sorted_arr)