Vasya writes his own library for building graphical user interface. Vasya called his creation
VTK (
VasyaToolKit). One of the interesting aspects of this library is that widgets are packed in each other.
A widget is some element of graphical interface. Each widget has width and height, and occupies some rectangle on the screen. Any widget in Vasya's library is of type
Widget. For simplicity we will identify the widget and its type.
Types
HBox and
VBox are derivatives of type
Widget, so they also are types
Widget. Widgets
HBox and
VBox are special. They can store other widgets. Both those widgets can use the
pack() method to pack directly in itself some other widget. Widgets of types
HBox and
VBox can store several other widgets, even several equal widgets − they will simply appear several times. As a result of using the method
pack() only the li
nk to the packed widget is saved, that is when the packed widget is changed, its image in the widget, into which it is packed, will also change.
We shall assume that the widget a is packed in the widget b if there exists a chain of widgets a=c1,c2,...,ck=b, k≥2, for which ci is packed directly to ci+1 for any 1≤i<k. In Vasya's library the situation when the widget a is packed in the widget a (that is, in itself) is not allowed. If you try to pack the widgets into each other in this manner immediately results in an error.
Also, the widgets HBox and VBox have parameters border and spacing, which are determined by the methods set_border() and set_spacing() respectively. By default both of these options equal 0.
The picture above shows how the widgets are packed into HBox and VBox. At that HBox and VBox automatically change their size depending on the size of packed widgets. As for HBox and VBox, they only differ in that in HBox the widgets are packed horizontally and in VBox − vertically. The parameter spacing sets the distance between adjacent widgets, and border − a frame around all packed widgets of the desired width. Packed widgets are placed exactly in the order in which the pack() method was called for them. If within HBox or VBox there are no packed widgets, their sizes are equal to 0×0, regardless of the options border and spacing.
The construction of all the widgets is performed using a scripting language Vasyascript. The description of the language can be found in the input data.
For the final verification of the code Vasya asks you to write a program that calculates the sizes of all the widgets on the source code in the language of Vasyascript.
Output
For each widget print on a single line its name, width and height, separated by spaces. The lines must be ordered lexicographically by a widget's name.
Please, do not use the
%lld specificator to read or write 64-bit integers in C++. It is preferred to use
cout stream (also you may use
%I64d specificator)
Examples
Output
brother 30 60
father 80 60
friend 20 60
grandpa 120 120
me 50 40
uncle 100 20
Output
dummy 0 0
pack 10 10
x 40 10
y 10 10
Note
In the first sample the widgets are arranged as follows: