Infer reordering directly from sampled variables.