How to take the input in this question

how to take the input int his quest. since the input consists of bool value and an integer value?

In this question, firstly you have to take data which is the numerical value, then after that you can take a string str, which will accept the data as true or false, true here means that you have a child and false means that you dont have a child. So try building the tree using this approach only.