private boolean depthFirstSearch(int vertex, int from) {
        was[vertex] = from == 2 ? 1 : 2;

        if (robots[vertex])
            if (was[vertex] == 2)
                evenRobots++;
            else
                unevenRobots++;

        for (int i = 0; i < adjacentVertices[vertex].size(); i++) {
            if (was[adjacentVertices[vertex].get(i)] == 0 && depthFirstSearch(adjacentVertices[vertex].get(i), from == 2 ? 1 : 2))
                return true;
            else if (was[adjacentVertices[vertex].get(i)] == was[vertex])
                return true;
        }

        return false;
    }