@Override
    public boolean equals(Object object) {
        if (!(object instanceof Road)) {
            return false;
        }
        Road road = (Road) object;
        if (road.getSpeed() != speed) {
            return false;
        }
        return road.getCityIndex1() == cityIndex1 && road.getCityIndex2() == cityIndex2 ||
              road.getCityIndex1() == cityIndex2 && road.getCityIndex2() == cityIndex1;
    }