offline equivalence class, known n and R, get all Equivalence class.
Two phases to determine equivalence class Phase 1: Equivalence pairs
(i, j) are read in and adjacency (linked) list of each object is built.
Phase 2: Trace (output) the equivalence class containing object i with
stack (depth-first search). Next find another object not yet output, and
repeat.