Trees — Width

Write a program that reads the shape of various binary trees, and prints the width of each one. We define the width of a tree as the maximal number of nodes that has at any of its levels (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 "Trees — Recursive traversal", with an exception: All the values are 0, because the content of the nodes here is not important.

Output

Your program must print the width of each given tree.

Problem information

Author: Unknown
Translator: Jordi Petit

Generation: 2026-01-25T10:33:49.465Z

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