3-way compare