func_code_string: #include <bits/stdc++.h>   const int xn = 200001, xe = 399999;   int head[xn], next[xe], to[xe], N, E, fa[xn], q[xn], ue[xn], O[xn * 5], L,       col[xn], D;   int main() {     scanf( %d , &N);     bool allblack = 1;     for (int i = 1; i <= N; i++) {       scanf( %d , col + i);       if (col[i] == -1) allblack = 0;     }     if (allblack) {       puts( 1 );       return 0;     }     for (int i = 1, u, v; i < N; i++) {       scanf( %d%d , &u, &v);       next[++E] = head[u], to[E] = v, head[u] = E;       next[++E] = head[v], to[E] = u, head[v] = E;     }     q[1] = 1;     ue[1] = head[1];     D = 1;     O[L = 1] = 1;     while (D) {       if (to[ue[D]] == fa[q[D]]) ue[D] = next[ue[D]];       if (ue[D]) {         int To = to[ue[D]];         ue[D] = next[ue[D]];         O[++L] = To;         fa[To] = q[D];         q[++D] = To;         ue[D] = head[To];       } else {         if (D > 1) {           O[++L] = q[D - 1];           col[q[D - 1]] *= col[q[D]];         }         D--;       }     }     printf( 1 );     for (int i = 1; i < L - 1; i++)       if (O[i] == fa[O[i + 1]] && col[O[i + 1]] == 1)         printf(  %d %d %d , O[i + 1], O[i], O[i + 1]);       else         printf(  %d , O[i + 1]);     if (col[1] == 1) printf(  1 );     puts(  );     return 0;   }   