Correctly compare relations with shared origin.