Trees — Height

Write a program that reads the shape of various binary trees, and prints the height of each one. We define the height of a tree as the maximal number of nodes of the paths that go from the root to each leaf (or zero, if the tree is empty).

Input

Input starts with mm, the number of trees that must be treated. The description of the mm trees follow as explained at problem P98436, with an exception: All the values are 0, because the content of the nodes here is not important.

Output

Your program must print the height of each given tree.

Problem information

Author: Unknown
Translator: Jordi Petit

Generation: 2026-02-13T10:34:02.287Z

© Jutge.org, 2006–2026.
https://jutge.org