Input
print 1
insertroot 1 100
insert 1 50 100 1
insert 1 80 100 2
insert 1 70 50 2
insert 1 25 80 1
insert 1 55 80 2
insert 1 30 1 100
insert 1 30 1 40
print 1
insertroot 2 20
insert 2 4 20 1
insert 2 15 20 2
insert 2 10 4 1
insert 2 2 15 1
insert 2 9 15 2
insert 2 11 9 1
insert 2 7 9 2
insert 2 5 11 1
print 2
siblings 2 7 11
siblings 2 22 11
frontier 2
leaves 2 15
leaves 2 33
subtreenodes 1 80 1 80
subtreenodes 1 100 2 15
subtreenodes 1 50 2 15
subtreenodes 1 10 2 15
deletesubtree 2 9
print 2
deletesubtree 1 30
print 1
deletesubtree 2 20
print 2
Output
Put your name here
Input file: input.txt
Command: print 1
Empty tree
Command: insertroot 1 100
Command: insert 1 50 100 1
Command: insert 1 80 100 2
Command: insert 1 70 50 2
Command: insert 1 25 80 1
Command: insert 1 55 80 2
Command: insert 1 30 1 100
Failed
Command: insert 1 30 1 40
Failed
Command: print 1
(() 50 (() 70 ())) 100 ((() 25 ()) 80 (() 55 ()))
Command: insertroot 2 20
Command: insert 2 4 20 1
Command: insert 2 15 20 2
Command: insert 2 10 4 1
Command: insert 2 2 15 1
Command: insert 2 9 15 2
Command: insert 2 11 9 1
Command: insert 2 7 9 2
Command: insert 2 5 11 1
Command: print 2
((() 10 ()) 4 ()) 20 ((() 2 ()) 15 (((() 5 ()) 11 ()) 9 (() 7 ())))
Command: siblings 2 7 11
Yes
Command: siblings 2 22 11
No
Command: frontier 2
7 5 2 10
Command: leaves 2 15
2 5 7
Command: leaves 2 33
Absent
Command: subtreenodes 1 80 1 80
Yes
Command: subtreenodes 1 100 2 15
Yes
Command: subtreenodes 1 50 2 15
No
Command: subtreenodes 1 10 2 15
No
Command: deletesubtree 2 9
Command: print 2
((() 10 ()) 4 ()) 20 ((() 2 ()) 15 ())
Command: deletesubtree 1 30
Command: print 1
(() 50 (() 70 ())) 100 ((() 25 ()) 80 (() 55 ()))
Command: deletesubtree 2 20
Command: print 2
Empty tree
Command processing completed.