// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define patkan 9
#define tisic 47
#define soclose 10e-7
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
// mylittlepony
using namespace std;
int main() {
cin.sync_with_stdio(0);
int N,a,b;
cin >> N;
vector< vector<int> > son(N);
vector<int> par(N,-1);
vector<int> state(N,0);
string s;
cin >> s;
for(int i =0; i < N; i++) {
if(s[i] == '+') state[i] =1;
if(s[i] == '-') state[i] =-1;}
if(state[0] == 0) state[0] =-1;
for(int i =1; i < N; i++) {
cin >> a >> b;
par[--b] =--a;
son[a].push_back(b);}
// dorataj state
queue<int> q;
q.push(0); par[0] =0;
vector<bool> live(N,true); live[0] =false;
vector<int> ord(1,0);
while(!q.empty()) {
a =q.front();
ALL_THE(son[a],it) if(live[*it]) {
live[*it] =false;
q.push(*it);
ord.push_back(*it);
if(state[*it] == 0) state[*it] =state[a];}
q.pop();}
vector<bool> allA(N,true);
for(int i =N-1; i >= 0; i--) {
a =ord[i];
ALL_THE(son[a],it) if(!allA[*it]) allA[a] =false;
if(son[a].empty() && state[a] == -1) allA[a] =false;}
a =0;
for(int i =0; i < N; i++)
if(allA[i] && (i == 0 || !allA[par[i]])) a++;
cout << a << "\n";
for(int i =0; i < N; i++) if(allA[i] && (i == 0 || !allA[par[i]])) {
cout << i+1;
a--;
if(a > 0) cout << " ";}
cout << "\n";
return 0;}
// look at my code
// my code is amazing
Ly8gaW9zdHJlYW0gaXMgdG9vIG1haW5zdHJlYW0KI2luY2x1ZGUgPGNzdGRpbz4KLy8gYml0Y2ggcGxlYXNlCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUg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