Structure of the Tree node
public class TreeNode { public int val ; public List < TreeNode > children ; public TreeNode ( int v ) { val = v ; children = new List < TreeNode > ( ) ; } } public class GFG {