# AT2172 [AGC007E] Shik and Travel

## 题面翻译

• $2\ <\ N\ <\ 131,072$
• $1\ \leq\ a_i\ \leq\ i$ for all $i$
• $0\ \leq\ v_i\ \leq\ 131,072$
• $v_i$ is an integer
• The given tree is a full binary tree