boolean check(int[][] graph, int[] node) {
    if (isConnected(graph, node) == false) {
      return false;
    }
    int odd = 0;
    for (int i = 0; i < node.length; i++) {
      if (node[i] % 2 != 0) {
        odd++;
      }
    }
    if (odd == 2 || odd == 0) {
      return true;
    } else {
      return false;
    }
  }