Iahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolutionary discovery, he invented a game for kids which uses xor-trees.

The game is played on a tree having n nodes, numbered from 1 to n. Each node i has an initial value initi, which is either 0 or 1. The root of the tree is node 1.

One can perform several (possibly, zero) operations on the tree during the game. The only available type of operation is to pick a node x. Right after someone has picked node x, the value of node x flips, the values of sons of x remain the same, the values of sons of sons of x flips, the values of sons of sons of sons of x remain the same and so on.

The goal of the game is to get each node i to have value goali, which can also be only 0 or 1. You need to reach the goal of the game by using minimum number of operations.

Input

The first line contains an integer n (1 ≤ n ≤ 105). Each of the next n - 1 lines contains two integers ui and vi (1 ≤ ui, vi ≤ n; ui ≠ vi) meaning there is an edge between nodes ui and vi. 

The next line contains n integer numbers, the i-th of them corresponds to initi (initi is either 0 or 1). The following line also contains n integer numbers, the i-th number corresponds to goali (goali is either 0 or 1).

Output

In the first line output an integer number cnt, representing the minimal number of operations you perform. Each of the next cnt lines should contain an integer xi, representing that you pick a node xi.

Examples

Input

10
2 1
3 1
4 2
5 1
6 2
7 5
8 6
9 8
10 5
1 0 1 1 0 1 0 1 0 1
1 0 1 0 0 1 1 1 0 1


Output

2
4
7

Source: codeforces | Difficulty: EASY
Tags: Tree algorithms

Graph traversal


Solutions:
N = int(100000.0 + 3)
n = int(input())
adj = list(([] for i in range(N)))
for _ in range(n - 1):
	(u, v) = map(int, input().split())
	adj[u].append(v)
	adj[v].append(u)
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))

def dfs(u, p, c_lvl, p_lvl, d):
	stk = [(u, p, c_lvl, p_lvl)]
	while stk:
		(u, p, c_lvl, p_lvl) = stk.pop()
		if c_lvl != d[u]:
			c_lvl = 1 - c_lvl
			res.append(str(u))
		for v in adj[u]:
			if v != p:
				stk += [(v, u, p_lvl, c_lvl)]
d = [i ^ j for (i, j) in zip(a, b)]
res = []
dfs(1, 0, 0, 0, d)
print(len(res))
print('\n'.join(res))


from collections import defaultdict, deque, Counter, OrderedDict
from bisect import insort, bisect_right, bisect_left
import threading, sys

def main():
	n = int(input())
	adj = [[] for i in range(n + 1)]
	for i in range(n - 1):
		(a, b) = map(int, input().split())
		(a, b) = (a - 1, b - 1)
		adj[a].append(b)
		adj[b].append(a)
	init = [int(i) for i in input().split()]
	goal = [int(i) for i in input().split()]
	visited = [0] * n
	par = [[] for i in range(n)]

	def dfs(s, p):
		if visited[s]:
			return
		visited[s] = 1
		par[p].append(s)
		for i in adj[s]:
			dfs(i, s)
	dfs(0, 0)
	par[0] = par[0][1:]
	ans = []

	def dfs2(s, l, fo, fe):
		if l % 2 == 0:
			if fe % 2 == 1:
				init[s] = 1 - init[s]
		elif fo % 2 == 1:
			init[s] = 1 - init[s]
		if init[s] != goal[s]:
			ans.append(s + 1)
			if l % 2:
				fo += 1
			else:
				fe += 1
		for j in par[s]:
			dfs2(j, l + 1, fo, fe)
	dfs2(0, 0, 0, 0)
	print(len(ans))
	print('\n'.join(map(str, ans)))
sys.setrecursionlimit(400000)
threading.stack_size(102400000)
thread = threading.Thread(target=main)
thread.start()


from sys import setrecursionlimit
import threading
setrecursionlimit(10 ** 9)
threading.stack_size(67108864)

def dfs(u):
	global al, used, parent
	for i in al[u]:
		if not used[i]:
			used[i] = True
			parent[i] = u
			dfs(i)

def fill(i):
	global parent, al, used, init, goal, changed, cnt, res
	if i == 0 or parent[i] == 0:
		changed[i] = 0
	else:
		changed[i] = changed[parent[parent[i]]]
	if changed[i] % 2 == 1:
		cur = 1 - init[i]
	else:
		cur = init[i]
	if cur != goal[i]:
		changed[i] += 1
		changed[i] %= 2
		cnt += 1
		res.append(i)
	for u in al[i]:
		if parent[i] != u:
			fill(u)

def main():
	global parent, al, used, init, goal, changed, cnt, res
	n = int(input())
	al = [[] for i in range(n)]
	for i in range(n - 1):
		(a, b) = [int(j) - 1 for j in input().split()]
		al[a].append(b)
		al[b].append(a)
	used = [False] * n
	parent = [-1] * n
	used[0] = True
	dfs(0)
	init = [int(i) for i in input().split()]
	goal = [int(i) for i in input().split()]
	changed = [0] * n
	used = [False] * n
	cnt = 0
	res = []
	fill(0)
	print(cnt)
	for i in res:
		print(i + 1)
thread = threading.Thread(target=main)
thread.start()


intin = lambda : map(int, input().split())
iin = lambda : int(input())
Ain = lambda : list(map(int, input().split()))
from queue import LifoQueue
mod = 1000000007
n = iin()
m = n + 1
v = [[] for i in range(m)]
p = [0] * m
for _ in range(n - 1):
	(a, b) = intin()
	v[a].append(b)
	v[b].append(a)
vis = [False] * m
flipped = [0] * m
flip = [0] * m
ans = []

def dfs(root):
	q = [root]
	while len(q) > 0:
		node = q.pop()
		vis[node] = True
		flipped[node] = flipped[p[p[node]]]
		if flipped[node] != flip[node]:
			flipped[node] ^= 1
			ans.append(node)
		for i in range(len(v[node])):
			son = v[node][i]
			if not vis[son]:
				q.append(son)
				p[son] = node
a = Ain()
b = Ain()
for i in range(n):
	flip[i + 1] = a[i] ^ b[i]
dfs(1)
print(len(ans))
for i in range(len(ans)):
	print(ans[i])


from sys import stdin, stdout
from collections import defaultdict, deque
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))

def bfs():
	global ans
	q = deque()
	p[1] = -1
	q.append(1)
	while q:
		src = q.popleft()
		if p[src] != -1 and p[p[src]] != -1:
			dp[src] = dp[p[p[src]]]
		if dp[src] ^ init[src - 1] != goal[src - 1]:
			dp[src] ^= 1
			ans += [src]
		for neigh in g[src]:
			if neigh == p[src]:
				continue
			p[neigh] = src
			q.append(neigh)
for _ in range(1):
	n = nmbr()
	g = defaultdict(list)
	for i in range(n - 1):
		(u, v) = lst()
		g[u] += [v]
		g[v] += [u]
	init = lst()
	goal = lst()
	p = [0] * (1 + n)
	dp = [0] * (1 + n)
	ans = []
	bfs()
	print(len(ans))
	print(*sorted(ans), sep='\n')


from sys import stdin, stdout, setrecursionlimit
import heapq
from math import gcd, ceil, sqrt
from collections import Counter, deque
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
setrecursionlimit(100000)
mod = 1000000007

def getAns(init, goal, d):
	queue = deque([[0, -1, 0, 0, 0]])
	seen = set()
	ans = []
	while len(queue):
		(cur, par, xor0, xor1, depth) = queue.popleft()
		if cur not in seen:
			seen.add(cur)
			if init[cur] ^ xor0 != goal[cur] and depth == 0:
				ans.append(cur + 1)
				xor0 ^= 1
			if init[cur] ^ xor1 != goal[cur] and depth == 1:
				ans.append(cur + 1)
				xor1 ^= 1
			for neigh in d.get(cur, []):
				queue.append([neigh, cur, xor0, xor1, depth ^ 1])
	return ans
n = ii1()
d = {}
for i in range(n - 1):
	(a, b) = iia()
	d.setdefault(a - 1, []).append(b - 1)
	d.setdefault(b - 1, []).append(a - 1)
init = iia()
goal = iia()
ans = getAns(init, goal, d)
print(len(ans))
for i in ans:
	print(i)


__author__ = 'artyom'

def read_int():
	return int(input())

def read_int_ary():
	return map(int, input().split())
n = read_int()
g = [[] for x in range(n + 1)]
for i in range(n - 1):
	(u, v) = read_int_ary()
	g[u].append(v)
	g[v].append(u)
init = [0] + list(read_int_ary())
goal = [0] + list(read_int_ary())
s = []

def solve(graph, start):
	stack = [(start, -1, 0, [1, 1])]
	while stack:
		(node, parent, sign, st) = stack.pop(-1)
		if init[node] ^ st[sign] == goal[node]:
			s.append(node)
			st = list(st)
			st[sign] ^= 1
		sign ^= 1
		for child in graph[node]:
			if child != parent:
				stack.append((child, node, sign, st))
solve(g, 1)
print(len(s))
print('\n'.join(map(str, s)))


from sys import stdin, setrecursionlimit
from collections import defaultdict
setrecursionlimit(1500000)

def counter(num):
	if num == 0:
		return 1
	else:
		return 0

def flip_me(original, count, index):
	if count % 2 == 0:
		return original[index]
	else:
		return counter(original[index])

def dfs(graph, visited, ans, original, goal, change, node, dfs_stack):
	dfs_stack.append(node)
	while len(dfs_stack) > 0:
		node = dfs_stack.pop()
		visited[node] = True
		value = flip_me(original, change[node], node - 1)
		add = 0
		if goal[node - 1] == value:
			pass
		else:
			add = 1
			ans[node] = True
		flag = 0
		for i in graph[node]:
			if visited[i] == False:
				flag = 1
				for j in graph[i]:
					if visited[j] == False:
						change[j] += change[node] + add
				dfs_stack.append(node)
				dfs_stack.append(i)
				break
		if flag == 0:
			pass

def calculate(graph, original, goal, n):
	visited = dict()
	change = dict()
	for i in range(1, n + 1):
		visited[i] = False
		change[i] = 0
	ans = dict()
	dfs_stack = []
	dfs(graph, visited, ans, original, goal, change, 1, dfs_stack)
	return ans
n = int(stdin.readline().strip())
graph = defaultdict(list)
for i in range(1, n + 1):
	graph[i]
for _ in range(n - 1):
	(u, v) = list(map(int, stdin.readline().split()))
	graph[u].append(v)
	graph[v].append(u)
original = list(map(int, stdin.readline().split()))
goal = list(map(int, stdin.readline().split()))
count = [0]
ans = calculate(graph, original, goal, n)
print(len(ans))
for i in ans:
	print(i)


n = int(input())
p = [[] for i in range(n + 1)]
for i in range(n - 1):
	(a, b) = map(int, input().split())
	p[a].append(b)
	p[b].append(a)
(u, v) = (' ' + input()[::2], ' ' + input()[::2])
(s, q) = ([(1, 0, 0, 0)], [])
while s:
	(a, k, i, j) = s.pop()
	if k:
		if i != (u[a] != v[a]):
			q.append(a)
			i = 1 - i
	elif j != (u[a] != v[a]):
		q.append(a)
		j = 1 - j
	k = 1 - k
	for b in p[a]:
		p[b].remove(a)
		s.append((b, k, i, j))
print(len(q))
print('\n'.join(map(str, q)))


from collections import Counter, deque
import string
import bisect
import math
import sys, threading
sys.setrecursionlimit(10 ** 9)
threading.stack_size(10 ** 8)
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))
ans = 0

def solve():

	def bfs(node):
		dq = deque()
		dq.append(node)
		visited[node] = 1
		level[node] = 1
		while len(dq) > 0:
			node = dq.popleft()
			visited[node] = 1
			for i in tree[node]:
				if visited[i] == 0:
					level[i] = level[node] + 1
					visited[i] = 1
					dq.append(i)

	def dfs(node, level, even, odd):
		global ans
		visited[node] = 1
		if level[node] % 2:
			if (initial[node] + odd) % 2 == final[node]:
				pass
			else:
				ans += 1
				odd += 1
				pt.append(node)
		elif (initial[node] + even) % 2 == final[node]:
			pass
		else:
			ans += 1
			even += 1
			pt.append(node)
		for i in tree[node]:
			if visited[i] == 0:
				dfs(i, level, even, odd)
	testcases = 1
	for _ in range(testcases):
		n = vary(1)
		tree = [[] for i in range(n + 1)]
		for _ in range(n - 1):
			(u, v) = vary(2)
			tree[u].append(v)
			tree[v].append(u)
		initial = [44] + array_int()
		final = [55] + array_int()
		visited = [0] * (n + 1)
		level = [0] * (n + 1)
		bfs(1)
		visited = [0] * (n + 1)
		pt = []
		dfs(1, level, 0, 0)
		print(ans)
		for i in range(ans):
			print(pt[i])
threading.Thread(target=solve).start()


import sys
inp = sys.stdin.buffer.readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().rstrip('\n\r')
from types import GeneratorType

def recursive(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
counter = 0
init = []
goal = []
flip = []
ans = []

@recursive
def dfs(gr, node):
	global init, goal, counter, flip, parent, flip, ans
	if node != 0 and node not in gr[0]:
		flip[node] = flip[parent[parent[node]]]
	init[node] ^= flip[node]
	if init[node] != goal[node]:
		init[node] = goal[node]
		flip[node] ^= 1
		counter += 1
		ans.append(node + 1)
	for i in gr[node]:
		if i != parent[node]:
			parent[i] = node
			yield dfs(gr, i)
	yield
_T_ = 1
for _t_ in range(_T_):
	n = inin()
	counter = 0
	graph = [[] for i in range(n)]
	for i in range(n - 1):
		(u, v) = inar()
		graph[u - 1].append(v - 1)
		graph[v - 1].append(u - 1)
	flip = [0 for i in range(n)]
	parent = [-1 for i in range(n)]
	init = inar()
	goal = inar()
	dfs(graph, 0)
	print(counter)
	for i in ans:
		print(i)


n = int(input())
g = [[] for i in range(n)]
for i in range(n - 1):
	(a, b) = map(int, input().split())
	g[a - 1].append(b - 1)
	g[b - 1].append(a - 1)
start = list(map(int, input().split()))
goal = list(map(int, input().split()))
q = [(0, 0, 0, 0)]
ans = []
while q:
	(node, dst, a, b) = q.pop()
	if dst:
		if a != (start[node] != goal[node]):
			ans.append(node + 1)
			a = 1 - a
	elif b != (start[node] != goal[node]):
		ans.append(node + 1)
		b = 1 - b
	dst = 1 - dst
	for to in g[node]:
		g[to].remove(node)
		q.append((to, dst, a, b))
print(len(ans))
print('\n'.join(map(str, ans)))


from sys import stdin, stdout
n = int(input())
a = [[] for i in range(n)]
for i in range(n - 1):
	(c, d) = (int(o) for o in stdin.readline().split())
	a[c - 1].append(d - 1)
	a[d - 1].append(c - 1)
b = list((int(o) for o in stdin.readline().split()))
c = list((int(o) for o in stdin.readline().split()))
lv = [0] * n
lv[0] = 1
q = [0]
while len(q) != 0:
	r = q.pop()
	for i in a[r]:
		if lv[i] == 0:
			lv[i] = lv[r] + 1
			q.append(i)
ans = ''
vis = [True] * n
vis[0] = False
k = 0
if b[0] == c[0]:
	q = [(0, 0, 0)]
else:
	q = [(0, 1, 0)]
	ans += '1' + '\n'
	k += 1
while len(q) != 0:
	(no, o, e) = q.pop()
	for i in a[no]:
		if vis[i]:
			l = e
			m = o
			vis[i] = False
			if lv[i] % 2 == 0:
				if b[i] == c[i] and l % 2 != 0:
					ans += str(i + 1) + '\n'
					l += 1
					k += 1
				elif b[i] != c[i] and l % 2 == 0:
					ans += str(i + 1) + '\n'
					l += 1
					k += 1
			elif b[i] == c[i] and m % 2 != 0:
				ans += str(i + 1) + '\n'
				m += 1
				k += 1
			elif b[i] != c[i] and m % 2 == 0:
				ans += str(i + 1) + '\n'
				m += 1
				k += 1
			q.append((i, m, l))
print(k)
stdout.write(ans)


import math, sys
from collections import defaultdict, deque
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')

def I():
	return int(sys.stdin.readline())

def In():
	return map(int, sys.stdin.readline().split())

def Sn():
	return sys.stdin.readline().strip()

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		d = defaultdict(list)
		for i in range(n - 1):
			(a, b) = In()
			d[a].append(b)
			d[b].append(a)
		a = [0] + list(In())
		b = [0] + list(In())
		parent = [-1] * (n + 1)
		visit = [False] * (n + 1)
		dp = [0] * (n + 1)
		q = deque([1])
		parent[1] = 0
		ans = []
		cnt = 0
		while q:
			node = q.popleft()
			if visit[node]:
				continue
			if a[node] ^ dp[parent[parent[node]]] != b[node]:
				ans.append(node)
				dp[node] = 1 ^ dp[parent[parent[node]]]
				cnt += 1
			else:
				dp[node] = dp[parent[parent[node]]]
			visit[node] = True
			for x in d[node]:
				if not visit[x]:
					q.appendleft(x)
					parent[x] = node
		print(cnt)
		for x in ans:
			print(x)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(1):
	main()


from collections import deque
stack = deque()
n = int(input())
links = [tuple(map(lambda x: int(x) - 1, input().split())) for i in range(n - 1)]
linked_to = [[] for i in range(n)]
for (x, y) in links:
	linked_to[x].append(y)
	linked_to[y].append(x)
init = list(map(lambda x: x == '1', input().split()))
goal = list(map(lambda x: x == '1', input().split()))
stack.append(0)
ops = 0
visited = [False] * n
parent = [n] * (n + 1)
was_swapped = [False] * (n + 1)
visited[0] = True

def xor(x, y):
	return x != y

def get_chld(i):
	for e in linked_to[i]:
		if e != parent[i]:
			yield e
while len(stack) > 0:
	c = stack.pop()
	for l in linked_to[c]:
		if not visited[l]:
			visited[l] = True
			parent[l] = c
			stack.append(l)
chosen = []
stack.append(0)
while len(stack) > 0:
	c = stack.pop()
	stack.extend(get_chld(c))
	was_swapped[c] = was_swapped[parent[parent[c]]]
	if xor(xor(init[c], goal[c]), was_swapped[c]):
		was_swapped[c] = not was_swapped[c]
		ops += 1
		chosen.append(c + 1)
print(ops, *chosen, sep='\n')


import sys
sys.setrecursionlimit(150000)
from collections import deque, Counter, OrderedDict, defaultdict

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def dfs(current_node, xor, change_zero, change_one):
	stack = [(current_node, xor, change_zero, change_one)]
	global visited, ans, store
	while stack:
		(current_node, xor, change_zero, change_one) = stack.pop()
		visited[current_node - 1] = True
		if xor == 0:
			if change[current_node - 1] != current[current_node - 1]:
				if ~change_zero & 1:
					change_zero += 1
					ans += 1
					store.append(current_node)
			elif change_zero & 1:
				change_zero += 1
				ans += 1
				store.append(current_node)
		elif change[current_node - 1] != current[current_node - 1]:
			if ~change_one & 1:
				change_one += 1
				ans += 1
				store.append(current_node)
		elif change_one & 1:
			change_one += 1
			ans += 1
			store.append(current_node)
		new_xor = xor ^ 1
		for child in mydict[current_node]:
			if not visited[child - 1]:
				stack.append((child, new_xor, change_zero, change_one))
n = int(input())
mydict = defaultdict(list)
for i in range(n - 1):
	(x, y) = get_ints()
	mydict[x].append(y)
	mydict[y].append(x)
current = get_array()
change = get_array()
ans = 0
current_node = 1
store = []
visited = [False] * n
dfs(current_node, 1, 0, 0)
print(ans)
for i in store:
	print(i)


from collections import defaultdict, deque, Counter, OrderedDict
import sys

def main():
	n = int(input())
	adj = [[] for i in range(n + 1)]
	for i in range(n - 1):
		(a, b) = map(int, input().split())
		(a, b) = (a - 1, b - 1)
		adj[a].append(b)
		adj[b].append(a)
	init = [int(i) for i in input().split()]
	goal = [int(i) for i in input().split()]
	visited = [0] * n
	par = [[] for i in range(n)]
	dq = deque()
	dq.append((0, 0))
	while len(dq) > 0:
		(s, p) = dq.pop()
		if visited[s]:
			continue
		visited[s] = 1
		par[p].append(s)
		for i in adj[s]:
			dq.append((i, s))
	par[0] = par[0][1:]
	ans = []
	dq = deque()
	dq.append((0, 0, 0, 0))
	while len(dq) > 0:
		(s, l, fo, fe) = dq.pop()
		if l % 2 == 0:
			if fe % 2 == 1:
				init[s] = 1 - init[s]
		elif fo % 2 == 1:
			init[s] = 1 - init[s]
		if init[s] != goal[s]:
			ans.append(s + 1)
			if l % 2:
				fo += 1
			else:
				fe += 1
		for j in par[s]:
			dq.append((j, l + 1, fo, fe))
	print(len(ans))
	print('\n'.join(map(str, ans)))
main()


from collections import defaultdict, deque, Counter, OrderedDict
from bisect import insort, bisect_right, bisect_left
import threading

def main():
	n = int(input())
	adj = [[] for i in range(n + 1)]
	for i in range(n - 1):
		(a, b) = map(int, input().split())
		(a, b) = (a - 1, b - 1)
		adj[a].append(b)
		adj[b].append(a)
	init = [int(i) for i in input().split()]
	goal = [int(i) for i in input().split()]
	visited = [0] * n
	par = [[] for i in range(n)]
	dq = deque()
	dq.append((0, 0))
	while len(dq) > 0:
		(s, p) = dq.pop()
		if visited[s]:
			continue
		visited[s] = 1
		par[p].append(s)
		for i in adj[s]:
			dq.append((i, s))
	par[0] = par[0][1:]
	ans = []
	dq = deque()
	dq.append((0, 0, 0, 0))
	while len(dq) > 0:
		(s, l, fo, fe) = dq.pop()
		if l % 2 == 0:
			if fe % 2 == 1:
				init[s] = 1 - init[s]
		elif fo % 2 == 1:
			init[s] = 1 - init[s]
		if init[s] != goal[s]:
			ans.append(s + 1)
			if l % 2:
				fo += 1
			else:
				fe += 1
		for j in par[s]:
			dq.append((j, l + 1, fo, fe))
	print(len(ans))
	print('\n'.join(map(str, ans)))
thread = threading.Thread(target=main)
thread.start()


from sys import stdin, stdout
from collections import *
from math import gcd, floor, ceil

def st():
	return list(stdin.readline().strip())

def li():
	return list(map(int, stdin.readline().split()))

def mp():
	return map(int, stdin.readline().split())

def inp():
	return int(stdin.readline())

def pr(n):
	return stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	d = {i: [] for i in range(1, n + 1)}
	for i in range(n - 1):
		(a, b) = mp()
		d[a].append(b)
		d[b].append(a)
	l = [0] + li()
	k = [0] + li()
	flag = [0 for i in range(n + 1)]
	v = [0 for i in range(n + 1)]
	par = {i: -1 for i in range(1, n + 1)}
	q = deque([1])
	v[1] = 1
	ans = []
	while q:
		a = q.popleft()
		if par[a] != -1 and par[par[a]] != -1:
			flag[a] += flag[par[par[a]]]
		if l[a] != k[a]:
			if flag[a] % 2 == 0:
				flag[a] += 1
				ans.append(a)
		elif flag[a] % 2:
			flag[a] += 1
			ans.append(a)
		for i in d[a]:
			if not v[i]:
				v[i] = 1
				q.append(i)
				par[i] = a
	print(len(ans))
	print('\n'.join(map(str, ans)))
for _ in range(1):
	solve()


import sys

def dfs(tree, root, priv_root, cur_lvl, priv_lvl, diff, pick_list):
	if not tree:
		return
	stack = [(root, priv_root, cur_lvl, priv_lvl)]
	while stack:
		(root, priv_root, cur_lvl, priv_lvl) = stack.pop()
		if cur_lvl ^ diff[root]:
			cur_lvl ^= 1
			pick_list.append(str(root))
		stack += [(vertex, root, priv_lvl, cur_lvl) for vertex in tree[root] if vertex != priv_root]

def main():
	n = int(input())
	tree = dict()
	for _ in range(n - 1):
		(u, v) = [int(x) for x in input().split()]
		tree[u] = tree.get(u, set()) | set([v])
		tree[v] = tree.get(v, set()) | set([u])
	init = [0] + [int(x) for x in input().split()]
	goal = [0] + [int(x) for x in input().split()]
	diff = [i ^ j for (i, j) in zip(init, goal)]
	pick_list = list()
	dfs(tree, 1, 0, 0, 0, diff, pick_list)
	num = len(pick_list)
	print(num)
	if num:
		print('\n'.join(pick_list))
sys.exit(main())


from collections import defaultdict, Counter

def solve(tree, nodes2change):
	nodes2pick = []
	for node in nodes2change:
		nodes2pick.append(node)
		for child in tree[node]:
			for nephew in tree[child]:
				nodes2pick.append(nephew)
	ans = []
	cnt = Counter(nodes2pick)
	for (k, v) in cnt.items():
		if v % 2 == 1:
			ans.append(k)
	return ans

def main():
	n = int(input())
	graph = defaultdict(list)
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		graph[u].append(v)
		graph[v].append(u)
	node = 1
	stack = [1]
	visited = [False] * (n + 1)
	visited[1] = True
	tree = defaultdict(list)
	while stack:
		cur = stack.pop()
		for child in graph[cur]:
			if not visited[child]:
				tree[cur].append(child)
				stack.append(child)
				visited[child] = True
	nodes2change = []
	start = [int(c) for c in input().split()]
	end = [int(c) for c in input().split()]
	for (i, (s, e)) in enumerate(zip(start, end), 1):
		if s != e:
			nodes2change.append(i)
	ans = solve(tree, nodes2change)
	print(len(ans))
	for node in ans:
		print(node)
main()


n = int(input())
L = [[] for i in range(n)]
for i in range(n - 1):
	(a, b) = map(int, input().split())
	L[a - 1].append(b - 1)
	L[b - 1].append(a - 1)
l = list(map(int, input().split()))
l1 = list(map(int, input().split()))
W = []
for i in range(n):
	W.append(abs(l[i] - l1[i]))
was = [0 for i in range(n)]
q = [[0, 0, 0]]
ans = []
while q:
	e = q[0]
	was[e[0]] = 1
	if e[1] != W[e[0]]:
		ans.append(e[0] + 1)
		e[1] = 1 - e[1]
	for x in L[e[0]]:
		if was[x] == 0:
			q.append([x, e[2], e[1]])
	del q[0]
print(len(ans))
print('\n'.join(map(str, ans)))


import sys
readline = sys.stdin.readline

def i1():
	return int(readline())

def nl():
	return [int(s) for s in readline().split()]

def nn(n):
	return [int(readline()) for i in range(n)]

def nnp(n, x):
	return [int(readline()) + x for i in range(n)]

def nmp(n, x):
	return (int(readline()) + x for i in range(n))

def nlp(x):
	return [int(s) + x for s in readline().split()]

def nll(n):
	return [[int(s) for s in readline().split()] for i in range(n)]

def mll(n):
	return ([int(s) for s in readline().split()] for i in range(n))

def s1():
	return readline().rstrip()

def sl():
	return [s for s in readline().split()]

def sn(n):
	return [readline().rstrip() for i in range(n)]

def sm(n):
	return (readline().rstrip() for i in range(n))

def redir(s):
	global readline
	import os
	fn = sys.argv[0] + f'/../in-{s}.txt'
	readline = open(fn).readline if os.path.exists(fn) else readline
redir('a')
n = i1()
nodes = [[] for i in range(n + 1)]
for i in range(n - 1):
	(u, v) = nl()
	nodes[u].append(v)
	nodes[v].append(u)
init = [0] + nl()
goal = [0] + nl()
roots = [1]
flip = [[0] * (n + 1), [0] * (n + 1)]
fa = [0] * (n + 1)
fa[1] = 1
level = 0
m = []
while roots:
	_roots = []
	fli = flip[level % 2]
	for r in roots:
		assert fa[r] > 0 or r == 1
		f = fli[fa[fa[r]]]
		if f ^ init[r] != goal[r]:
			f = 1 - f
			m.append(r)
		fli[r] = f
		for i in nodes[r]:
			if fa[i] == 0:
				_roots.append(i)
				fa[i] = r
	roots = _roots
	level += 1
init[0] = goal[0] = None
print(len(m))
print('\n'.join((str(i) for i in m)))


import sys
lines = sys.stdin.readlines()
n = int(lines[0].strip())
edges = {}
for i in range(1, n):
	(u, v) = map(int, lines[i].strip().split(' '))
	if u not in edges:
		edges[u] = []
	if v not in edges:
		edges[v] = []
	edges[u].append(v)
	edges[v].append(u)
fst = list(map(int, lines[n].strip().split(' ')))
goals = list(map(int, lines[n + 1].strip().split(' ')))
curr = [0 for _ in range(n)]
for i in range(n):
	goals[i] ^= fst[i]
for i in range(1, n + 1):
	if i not in edges:
		edges[i] = []
parent = {}
seen = set([1])
stack = [1]
while stack:
	node = stack.pop()
	for adj in edges[node]:
		if adj not in seen:
			seen.add(adj)
			stack.append(adj)
			parent[adj] = node
cnt = 0
stack = [1]
flip = []
seen = set([1])
while stack:
	node = stack.pop()
	if node not in parent or parent[node] not in parent:
		if goals[node - 1] != curr[node - 1]:
			cnt += 1
			flip.append(node)
			curr[node - 1] = goals[node - 1]
	else:
		grandpa = parent[parent[node]]
		if goals[node - 1] != curr[grandpa - 1]:
			cnt += 1
			flip.append(node)
		curr[node - 1] = goals[node - 1]
	for adj in edges[node]:
		if adj not in seen:
			stack.append(adj)
			seen.add(adj)
print(cnt)
for node in flip:
	print(node)


n = int(input())
adj = [[] for i in range(n + 1)]
for i in range(n - 1):
	(a, b) = map(int, input().split())
	adj[a].append(b)
	adj[b].append(a)
u = [-1] + list(map(int, input().split()))
v = [-1] + list(map(int, input().split()))
q = [(1, 0, 0, 0)]
ans = []
while q:
	(x, a, b, c) = q.pop()
	if a:
		if b != (u[x] != v[x]):
			ans.append(x)
			b = 1 - b
	elif c != (u[x] != v[x]):
		ans.append(x)
		c = 1 - c
	a = 1 - a
	for i in adj[x]:
		adj[i].remove(x)
		q.append((i, a, b, c))
print(len(ans))
print('\n'.join(map(str, ans)))


import sys
import threading
for test in range(1):
	n = int(input())
	global adj
	adj = list(([] for i in range(n + 1)))
	for i in range(n - 1):
		(a, b) = map(int, input().split())
		adj[a].append(b)
		adj[b].append(a)
	cur = [0] + list(map(int, input().split()))
	tobe = [0] + list(map(int, input().split()))
	ans = 0
	op = []

	def dfs(node, par=-1, par_changes=0, gpar_changes=0):
		if gpar_changes % 2:
			cur[node] ^= 1
		if cur[node] != tobe[node]:
			cur[node] ^= 1
			global ans
			ans += 1
			global op
			op.append(node)
			gpar_changes += 1
		for child in adj[node]:
			if child == par:
				continue
			dfs(child, node, gpar_changes, par_changes)

def main():
	dfs(1)
	print(ans)
	for i in op:
		print(i)
sys.setrecursionlimit(10 ** 6)
threading.stack_size(10 ** 8)
t = threading.Thread(target=main)
t.start()
t.join()


import sys
import threading
from collections import defaultdict
ans = 0
li = []
n = int(input())
adj = defaultdict(list)
for _ in range(n - 1):
	(x, y) = list(map(int, input().split()))
	adj[y].append(x)
	adj[x].append(y)
inite = list(map(int, input().split()))
finale = list(map(int, input().split()))

def fun(root, par, ab1, ab2):
	global ans
	if ab2 & 1 and inite[root - 1] == finale[root - 1]:
		ans += 1
		li.append(root)
		ab2 += 1
	elif not ab2 & 1 and inite[root - 1] != finale[root - 1]:
		ans += 1
		li.append(root)
		ab2 += 1
	for ch in adj[root]:
		if ch != par:
			fun(ch, root, ab2, ab1)

def main():
	fun(1, 0, 0, 0)
	print(ans)
	for i in li:
		print(i)
sys.setrecursionlimit(10 ** 6)
threading.stack_size(10 ** 8)
t = threading.Thread(target=main)
t.start()
t.join()


from collections import deque
N = int(input())
links = [[] for i in range(N)]
for i in range(N - 1):
	(u, v) = map(int, input().split())
	links[v - 1].append(u - 1)
	links[u - 1].append(v - 1)
init = list(map(int, input().split()))
goal = list(map(int, input().split()))
nbFlip = 0
flipped = []
stack = []
stack.append((0, -1, 0, 0, 0))
while len(stack) > 0:
	(i, parent, depth, nbEvens, nbOdds) = stack.pop()
	if depth % 2 == 0:
		nodeValue = (init[i] + nbEvens) % 2
		if nodeValue != goal[i]:
			nbFlip += 1
			nbEvens += 1
			flipped.append(i)
	else:
		nodeValue = (init[i] + nbOdds) % 2
		if nodeValue != goal[i]:
			nbFlip += 1
			nbOdds += 1
			flipped.append(i)
	for link in links[i]:
		if link != parent:
			stack.append((link, i, depth + 1, nbEvens, nbOdds))
print(nbFlip)
for flip in flipped:
	print(flip + 1)


n = int(input())
A = [[] for i in range(n + 1)]
for i in range(n - 1):
	(a, b) = map(int, input().split())
	A[a].append(b)
	A[b].append(a)
B = list(map(int, input().split()))
C = list(map(int, input().split()))
D = []
S = [(1, 0, 0, 0)]
while len(S) != 0:
	(u, a, b, c) = S.pop()
	if c == 0:
		if a != (B[u - 1] != C[u - 1]):
			D.append(u)
			a = 1 - a
	elif b != (B[u - 1] != C[u - 1]):
		D.append(u)
		b = 1 - b
	c = 1 - c
	for x in A[u]:
		A[x].remove(u)
		S.append((x, a, b, c))
print(len(D))
print('\n'.join(map(str, D)))


import sys
(_ord, inp, num, neg, _Index) = (lambda x: x, [], 0, False, 0)
(i, s) = (0, sys.stdin.buffer.read())
try:
	while True:
		if s[i] >= b'0'[0]:
			num = 10 * num + _ord(s[i]) - 48
		elif s[i] == b'-'[0]:
			neg = True
		elif s[i] != b'\r'[0]:
			inp.append(-num if neg else num)
			(num, neg) = (0, False)
		i += 1
except IndexError:
	pass
if s and s[-1] >= b'0'[0]:
	inp.append(-num if neg else num)

def inin(size=None):
	global _Index
	if size == None:
		ni = _Index
		_Index += 1
		return inp[ni]
	else:
		ni = _Index
		_Index += size
		return inp[ni:ni + size]
from types import GeneratorType

def recursive(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
counter = 0
init = []
goal = []
flip = []
ans = []

@recursive
def dfs(gr, node):
	global init, goal, counter, flip, parent, flip, ans
	if node != 0 and node not in gr[0]:
		flip[node] = flip[parent[parent[node]]]
	init[node] ^= flip[node]
	if init[node] != goal[node]:
		init[node] = goal[node]
		flip[node] ^= 1
		counter += 1
		ans.append(node + 1)
	for i in gr[node]:
		if i != parent[node]:
			parent[i] = node
			yield dfs(gr, i)
	yield
_T_ = 1
for _t_ in range(_T_):
	n = inin()
	counter = 0
	graph = [[] for i in range(n)]
	for i in range(n - 1):
		(u, v) = inin(2)
		graph[u - 1].append(v - 1)
		graph[v - 1].append(u - 1)
	flip = [0 for i in range(n)]
	parent = [-1 for i in range(n)]
	init = inin(n)
	goal = inin(n)
	dfs(graph, 0)
	print(counter)
	for i in ans:
		print(i)


from collections import defaultdict
n = int(input())
d = defaultdict(list)

def DFSop(d1, x, goal, state, visited):
	c = 0
	stack = [(x, c)]
	l = []
	while len(stack):
		(temp, c) = stack.pop()
		visited[temp] = 1
		if c % 2 == 1:
			state[temp - 1] = 1 - state[temp - 1]
		if state[temp - 1] != goal[temp - 1]:
			c = c + 1
			state[temp - 1] = goal[temp - 1]
			l.append(temp)
		for i in d1[temp]:
			if visited[i] == 0:
				stack.append((i, c))
	return l

def DFS(d, x, parent, visited):
	stack = [(x, 0)]
	d1 = defaultdict(list)
	while len(stack):
		(temp, parent) = stack.pop()
		visited[temp] = 1
		for i in d[temp]:
			if visited[i] == 0:
				d1[parent].append(i)
				stack.append((i, temp))
	return d1
for i in range(n - 1):
	(a, b) = map(int, input().split())
	d[a].append(b)
	d[b].append(a)
parent = 0
visited = [0 for i in range(n + 1)]
x = 1
state = list(map(int, input().split()))
goal = list(map(int, input().split()))
c = 0
x = 1
parent = 0
d1 = DFS(d, x, parent, visited)
visited = [0 for i in range(n + 1)]
l = []
ans = DFSop(d1, x, goal, state, visited)
for i in d[1]:
	ans = ans + DFSop(d1, i, goal, state, visited)
ans = set(ans)
print(len(ans))
for i in ans:
	print(i)


import sys
import math
from collections import defaultdict
MAXNUM = math.inf
MINNUM = -1 * math.inf
ASCIILOWER = 97
ASCIIUPPER = 65

def getInt():
	return int(sys.stdin.readline().rstrip())

def getInts():
	return map(int, sys.stdin.readline().rstrip().split(' '))

def getString():
	return sys.stdin.readline().rstrip()

def printOutput(ans):
	sys.stdout.write()
	pass

class dfsData:

	def __init__(self):
		self.total = 0

def dfsHelper(adjList, start, goal, cur, explored, xor, data):
	if start[cur] != goal[cur]:
		data.total += 1
		xor = (xor + 1) % 2
	for ele in adjList[cur]:
		if ele not in explored:
			explored[ele] = True
			dfs(adjList, start, goal, ele, explored, xor, data)

def dfs(adjList, start, goal):
	explored = dict()
	explored[1] = True
	data = dfsData()
	dfsHelper(adjList, start, goal, 1, explored, 0, data)
	return data.total

def iterdfs(adjList, init, goal):
	stack = []
	start = (1, 0, 0)
	stack.append(start)
	explored = {}
	explored[start] = True
	total = 0
	flip = []
	while stack:
		(curNode, xor, nxtXor) = stack.pop()
		if (init[curNode] + xor) % 2 != goal[curNode]:
			total += 1
			xor = (xor + 1) % 2
			flip.append(curNode)
		for ele in adjList[curNode]:
			if ele not in explored:
				explored[ele] = True
				stack.append((ele, nxtXor, xor))
	return (total, flip)

def solve(adjList, start, goal):
	return iterdfs(adjList, start, goal)

def readinput():
	edges = getInt()
	adjList = defaultdict(list)
	for _ in range(edges - 1):
		(a, b) = getInts()
		adjList[a].append(b)
		adjList[b].append(a)
	start = [0] + list(getInts())
	goal = [0] + list(getInts())
	(t, f) = solve(adjList, start, goal)
	print(t)
	for ele in f:
		print(ele)
readinput()


from collections import defaultdict, deque
from typing import Any, List, Tuple

def solve(n: int, adj: List[List[int]], init: List[int], goal: List[int]) -> List[int]:
	g = defaultdict(list)
	for (u, v) in adj:
		g[u].append(v)
		g[v].append(u)
	visited = [0] * n
	q = deque([[1, 0, 0, 0]])
	ops = []
	while q:
		(curr, height, even_ops, odd_ops) = q.popleft()
		visited[curr - 1] = 1
		if height % 2 == 0:
			if init[curr - 1] ^ [0, 1][even_ops % 2] != goal[curr - 1]:
				even_ops += 1
				ops.append(curr)
		elif height % 2 == 1:
			if init[curr - 1] ^ [0, 1][odd_ops % 2] != goal[curr - 1]:
				odd_ops += 1
				ops.append(curr)
		for neighbor in g[curr]:
			if not visited[neighbor - 1]:
				q.append([neighbor, height + 1, even_ops, odd_ops])
	return ops
n = int(input())
adj = [list(map(int, input().split())) for _ in range(n - 1)]
init = list(map(int, input().split()))
goal = list(map(int, input().split()))
ans = solve(n, adj, init, goal)
print(len(ans))
for x in ans:
	print(x)


import sys
read = lambda t=int: list(map(t, sys.stdin.readline().split()))
(n,) = read()
graph = [[] for _ in range(n)]
for _ in range(n - 1):
	(a, b) = read()
	graph[a - 1].append(b - 1)
	graph[b - 1].append(a - 1)
initial = read()
goal = read()
ansList = []

def dfs(node, par, odd, even, level):
	if level == 0:
		if initial[node] ^ even != goal[node]:
			ansList.append(node)
			even ^= 1
	if level == 1:
		if initial[node] ^ odd != goal[node]:
			ansList.append(node)
			odd ^= 1
	for item in graph[node]:
		if item != par:
			yield (item, node, odd, even, level ^ 1)
stack = [(0, -1, 0, 0, 0)]
while stack:
	for item in dfs(*stack.pop()):
		stack.append(item)
print(len(ansList))
for ele in ansList:
	print(ele + 1)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
inp = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().rstrip('\n\r')
from types import GeneratorType

def recursive(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
counter = 0
init = []
goal = []
flip = []
ans = []

@recursive
def dfs(gr, node):
	global init, goal, counter, flip, parent, flip, ans
	if node != 0 and node not in gr[0]:
		flip[node] = flip[parent[parent[node]]]
	init[node] ^= flip[node]
	if init[node] != goal[node]:
		init[node] = goal[node]
		flip[node] ^= 1
		counter += 1
		ans.append(node + 1)
	for i in gr[node]:
		if i != parent[node]:
			parent[i] = node
			yield dfs(gr, i)
	yield
_T_ = 1
for _t_ in range(_T_):
	n = inin()
	counter = 0
	graph = [[] for i in range(n)]
	for i in range(n - 1):
		(u, v) = inar()
		graph[u - 1].append(v - 1)
		graph[v - 1].append(u - 1)
	flip = [0 for i in range(n)]
	parent = [-1 for i in range(n)]
	init = inar()
	goal = inar()
	dfs(graph, 0)
	print(counter)
	for i in ans:
		print(i)


def main():
	n = int(input())
	l = [[] for _ in range(n + 1)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		l[u].append(v)
		l[v].append(u)
	sw = [a != b for (a, b) in zip(input()[::2], input()[::2])]
	root = (1, False, False)
	(nxt, res, avail) = ([root], [0], [True] * (n + 1))
	while nxt:
		(cur, nxt) = (nxt, [])
		for (v, a, b) in cur:
			if sw[v - 1] != a:
				a = not a
				res.append(v)
			avail[v] = False
			for u in l[v]:
				if avail[u]:
					nxt.append((u, b, a))
	res[0] = len(res) - 1
	print('\n'.join(map(str, res)))
main()


import sys
import threading
from collections import defaultdict
n = int(input())
adj = defaultdict(list)
for i in range(n - 1):
	(x, y) = map(int, input().split())
	adj[x].append(y)
	adj[y].append(x)
intial = list(map(int, input().split()))
target = list(map(int, input().split()))
flip_node = []
global count
count = 0
grand_flag = False

def dfs(node, par, parentFlip, grandParentFlip):
	grand_flag = False
	if intial[node - 1] != target[node - 1]:
		if grandParentFlip % 2 == 0:
			flip_node.append(node)
			grand_flag = True
	elif grandParentFlip % 2 != 0:
		flip_node.append(node)
		grand_flag = True
	for i in range(len(adj[node])):
		if adj[node][i] != par:
			if grand_flag:
				dfs(adj[node][i], node, grandParentFlip + 1, parentFlip)
			else:
				dfs(adj[node][i], node, grandParentFlip, parentFlip)

def main():
	par = 0
	grandParentFlip = 0
	parentFlip = 0
	grand_flip = False
	dfs(1, par, parentFlip, grandParentFlip)
	print(len(flip_node))
	for i in flip_node:
		print(i, end='\n')
sys.setrecursionlimit(10 ** 6)
threading.stack_size(10 ** 8)
t = threading.Thread(target=main)
t.start()
t.join()


import sys
read = lambda t=int: list(map(t, sys.stdin.readline().split()))
(N,) = read()
tree = [[] for _ in range(N)]
for _ in range(N - 1):
	(a, b) = read()
	tree[a - 1].append(b - 1)
	tree[b - 1].append(a - 1)
labels = read()
goals = read()
res = []

def dfs(root, par, xor0, xor1, depth):
	if depth == 0:
		if labels[root] ^ xor0 != goals[root]:
			res.append(root)
			xor0 ^= 1
	if depth == 1:
		if labels[root] ^ xor1 != goals[root]:
			res.append(root)
			xor1 ^= 1
	for v in tree[root]:
		if v != par:
			yield (v, root, xor0, xor1, depth ^ 1)
stack = [(0, -1, 0, 0, 0)]
while stack:
	for item in dfs(*stack.pop()):
		stack.append(item)
print(len(res))
for x in res:
	print(x + 1)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')

def seive():
	prime = [1 for i in range(10 ** 6 + 1)]
	prime[0] = 0
	prime[1] = 0
	for i in range(10 ** 6 + 1):
		if prime[i]:
			for j in range(2 * i, 10 ** 6 + 1, i):
				prime[j] = 0
	return prime
n = L()[0]
A = [L() for i in range(n - 1)]
g = [[] for i in range(n + 1)]
for (x, y) in A:
	g[x].append(y)
	g[y].append(x)
curr = L()
target = L()
q = deque()
q.append([1, 0, int(curr[0] != target[0])])
vis = [0 for i in range(n + 1)]
vis[1] = 1
turns = []
if curr[0] != target[0]:
	turns.append(1)
while q:
	(node, l2, l1) = q.popleft()
	for neigh in g[node]:
		if vis[neigh]:
			continue
		vis[neigh] = 1
		if (curr[neigh - 1] + l2) % 2 != target[neigh - 1]:
			turns.append(neigh)
			q.append([neigh, l1, (l2 + 1) % 2])
		else:
			q.append([neigh, l1, l2])
print(len(turns))
for ele in turns:
	print(ele)
endtime = time.time()