convert state machine/stack-based meld to pairwise