Union by Rank and Path Compression:
Ackermann's Function A(i,j)
Note: A(i,j) is strictly increasing and since m n.