pref alg works
merging