we don't actually care about the order here so res should be sorted.