Use queue in relevsort