Given a tree, count the height of the tree. Each node has unique integer identification (ID), but all IDs may not be consecutive
Hint :
Height of tree – The height of a tree is the number of edges on the longest path between that node and root.
There are multiple test cases. Each test case begins with an integer N (1 <= N <=1000). In the following N lines, each line has two integers, a and b (1 <= a,b <= 1000), indicating node a and node b connected. The next line contains an integer R, which represents the root of the Tree. All the nodes may not be on the same tree, but you only need to output the tree rooted with R. The input is terminated by N = 0.
Print the height of the tree (the number of edges on the longest path between that node and root) for each test case.