Sort device ids