from cyaron import *
def gen(io: IO):
VMIN = -100000
VMAX = 100000
n = randint(5, 10)
tree = Graph.tree(n)
io.input_writeln(n)
io.input_writeln(tree.to_str(output=Edge.unweighted_edge, shuffle=True))
io.input_writeln(list(map(lambda _: randint(VMIN, VMAX), [0]*n)))
q = randint(5, 15)
io.input_writeln(q)
for _ in range(q):
opt = randint(0, 2)
if opt == 0:
io.input_writeln("CHANGE", randint(1, n), randint(VMIN, VMAX))
elif opt == 1:
io.input_writeln("QSUM", randint(1,n), randint(1,n))
elif opt == 2:
io.input_writeln("QMAX", randint(1,n), randint(1,n))
ci = 1
while True:
io = IO(file_prefix="P2590", output_suffix=".ans")
gen(io)
io.output_gen("P2590std.exe")
_ = input(''.join([str(ci), ">\n"]))
ci += 1