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 init_{i}, 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 goal_{i}, 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 ≤ 10^5). Each of the next n - 1 lines contains two integers u_{i} and v_{i} (1 ≤ u_{i}, v_{i} ≤ n; u_{i} ≠ v_{i}) meaning there is an edge between nodes u_{i} and v_{i}. 

The next line contains n integer numbers, the i-th of them corresponds to init_{i} (init_{i} is either 0 or 1). The following line also contains n integer numbers, the i-th number corresponds to goal_{i} (goal_{i} 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 x_{i}, representing that you pick a node x_{i}.


-----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

Difficulty: competition

Starter code:

Solutions:
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) = list(map(int, input().split()))
        tree[u] = tree.get(u, set()) | set([v])
        tree[v] = tree.get(v, set()) | set([u])
    init = [0] + list(map(int, input().split()))
    goal = [0] + list(map(int, 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))

def __starting_point():
    return(main())

__starting_point()

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
    else:
        if 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)))

import sys
read = lambda t=int: list(map(t,sys.stdin.readline().split()))
# import resource, sys
# resource.setrlimit(resource.RLIMIT_STACK, (2**20,-1))
# sys.setrecursionlimit(10**5+5)

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)
# dfs(0, -1, 0, 0, 0)

print(len(res))
for x in res:
    print(x+1)


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) = map(int, input().split())
        tree[u] = tree.get(u, set()) | set([v])
        tree[v] = tree.get(v, set()) | set([u])
    init = [0] + list(map(int, input().split()))
    goal = [0] + list(map(int, 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))

def __starting_point():
    return(main())
__starting_point()

import sys


def dfs(tree, root, priv_root, cur_lvl, priv_lvl, diff, pick_list):
    # if tree is 1 or less nodes just return nothing
    if not tree:
        return
    stack = [(root, priv_root, cur_lvl, priv_lvl)]
    while stack:
        (root, priv_root, cur_lvl, priv_lvl) = stack.pop()
        # set level to account for only evens where a difference exists
        if cur_lvl ^ diff[root]:
            cur_lvl ^= 1
            pick_list.append(str(root))
        # add to the queue all cases where a vertex exists
        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()]
    # find numbers that don't match that need to be accounted for
    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))

def __starting_point():
    return(main())
__starting_point()

# 429A

__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, level, state, node, parent=-1):
# t = level % 2
# st = list(state)
# if init[node] ^ st[t] == goal[node]:
#     s.append(node)
#     st[t] = 1 - st[t]
#   for child in graph[node]:
#     if child != parent:
#       solve(graph, level + 1, st, child, node)


def solve(graph, start):
  stack = [(start, -1, [1, 1], 0)]
  while stack:
    params = stack.pop(-1)
    node = params[0]
    parent = params[1]
    st = list(params[2])
    sign = params[3]
    if init[node] ^ st[sign] == goal[node]:
      s.append(node)
      st[sign] = 1 - st[sign]
    sign = 1 - sign
    for child in graph[node]:
      if child != parent:
        stack.append((child, node, st, sign))


solve(g, 1)
print(len(s))
for v in s:
  print(v)

# 429A

__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, level, state, node, parent=-1):
# t = level % 2
# st = list(state)
# if init[node] ^ st[t] == goal[node]:
#     s.append(node)
#     st[t] = 1 - st[t]
#   for child in graph[node]:
#     if child != parent:
#       solve(graph, level + 1, st, child, node)


def solve(graph, start):
  stack = [(start, -1, [1, 1], 0)]
  while stack:
    params = stack.pop(-1)
    node = params[0]
    parent = params[1]
    st = list(params[2])
    sign = params[3]
    if init[node] ^ st[sign] == goal[node]:
      s.append(node)
      st[sign] ^= 1
    sign ^= 1
    for child in graph[node]:
      if child != parent:
        stack.append((child, node, st, sign))


solve(g, 1)
print(len(s))
for v in s:
  print(v)

# 429A

__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))
for v in s:
  print(v)

# 429A

__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)))

def main():
    n = int(input())
    l = [[] for _ in range(n + 1)]
    for _ in range(n - 1):
        u, v = list(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)))


def __starting_point():
    main()

__starting_point()

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]
        else:
            if 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)))



def __starting_point():
    main()
__starting_point()

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 = list(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]
        else:
            if 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)))

def __starting_point():
    """sys.setrecursionlimit(200000)
    threading.stack_size(10240000)"""
    thread = threading.Thread(target=main)
    thread.start()

__starting_point()

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 = list(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]
        else:
            if 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)))

def __starting_point():
    sys.setrecursionlimit(400000)
    threading.stack_size(102400000)
    thread = threading.Thread(target=main)
    thread.start()

__starting_point()

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]
        else:
            if 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)))

def __starting_point():
    sys.setrecursionlimit(400000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()
__starting_point()

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
    else:
        if 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)))

# Made By Mostafa_Khaled 
bot = True 
n = int(input())

p = [[] for i in range(n + 1)]

for i in range(n - 1):

    a, b = list(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

    else:

        if 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)))

# Made By Mostafa_Khaled


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()))

#print(init)
#print(goal)

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')



n=int(input())
L=[[] for i in range(n)]
for i in range(n-1) :
    a,b=list(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)))
        
        
    


'''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
'''

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

# main starts 
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)

intin=lambda:list(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])






    









N = int(1e5+3)
n = int(input())
adj = list([] for i in range(N))
for _ in range(n-1):
    u, v = list(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))


# Target - Expert on CF
# Be Humblefool

import sys

# inf = float("inf")
sys.setrecursionlimit(10000000)

# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
# mod, MOD = 1000000007, 998244353
# words = {1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',14:'fourteen',15:'quarter',16:'sixteen',17:'seventeen',18:'eighteen',19:'nineteen',20:'twenty',21:'twenty one',22:'twenty two',23:'twenty three',24:'twenty four',25:'twenty five',26:'twenty six',27:'twenty seven',28:'twenty eight',29:'twenty nine',30:'half'}
# vow=['a','e','i','o','u']
# dx,dy=[0,1,0,-1],[1,0,-1,0]

# import random
from collections import deque, Counter, OrderedDict,defaultdict
# from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
# from math import ceil,floor,log,sqrt,factorial,pi,gcd
# from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right

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)]
    nonlocal 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)
            else:
                if change_zero&1:
                    change_zero+=1
                    ans+=1
                    store.append(current_node)
        else:
            if change[current_node-1]!=current[current_node-1]:
                if ~change_one&1:
                    change_one+=1
                    ans+=1
                    store.append(current_node)
            else:
                if 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()

# change_zero,change_one = 0,0
ans = 0
current_node = 1
store = []
visited = [False]*(n)
dfs(current_node,1,0,0)
print(ans)
for i in store:
    print(i)

# Target - Expert on CF
# Be Humblefool

import sys

# inf = float("inf")
sys.setrecursionlimit(150000)

# abc='abcdefghijklmnopqrstuvwxyz'
# abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
# mod, MOD = 1000000007, 998244353
# words = {1:'one',2:'two',3:'three',4:'four',5:'five',6:'six',7:'seven',8:'eight',9:'nine',10:'ten',11:'eleven',12:'twelve',13:'thirteen',14:'fourteen',15:'quarter',16:'sixteen',17:'seventeen',18:'eighteen',19:'nineteen',20:'twenty',21:'twenty one',22:'twenty two',23:'twenty three',24:'twenty four',25:'twenty five',26:'twenty six',27:'twenty seven',28:'twenty eight',29:'twenty nine',30:'half'}
# vow=['a','e','i','o','u']
# dx,dy=[0,1,0,-1],[1,0,-1,0]

# import random
from collections import deque, Counter, OrderedDict,defaultdict
# from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
# from math import ceil,floor,log,sqrt,factorial,pi,gcd
# from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right

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)]
    nonlocal 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)
            else:
                if change_zero&1:
                    change_zero+=1
                    ans+=1
                    store.append(current_node)
        else:
            if change[current_node-1]!=current[current_node-1]:
                if ~change_one&1:
                    change_one+=1
                    ans+=1
                    store.append(current_node)
            else:
                if 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()

# change_zero,change_one = 0,0
ans = 0
current_node = 1
store = []
visited = [False]*(n)
dfs(current_node,1,0,0)
print(ans)
for i in store:
    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
    else:
        if 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)))