Static Tree

You are given a tree containing N vertices. The vertices are numbered from 1 to N. A tree with N vertices is an undirected connected graph with exactly N−1 edges. Each vertex of the tree contains a lowercase English letter.

This is a companion discussion topic for the original entry at

I love python also this . but it is very much annowing to get stuck again and again. I’m very new in data structure and algorithm. I want to solve all the question available in this site. so may i get python solution for this question.

you may find me asking python solutions for other questions as well so please don’t get me wrong.
Further please suggest me how to I improve myself in data structure and algorithm.