in treeview (python tkinter),I want to add parent, child and grandchild in manually

the data should look like

Parent name

child 1

grandchild 1

grandchild 2

child 2

grandchild 1

grandchild 2

grandchild 3

child 3

grandchild 1

The data that I enter should be added as a grandchild to the respective child every time I enter (the entered child name should be checked with pre-existing child names in the tree view). The parent name is also user input. Note: The data is entered into TreeView only if all the input fields have value and the rate is a numeric value and initial parent name(That is data should not enter if the user gives a different parent name after giving the initial parent name).

main = Tk()
main.title("Tool")
main.geometry('1360x768')
global count
count =0
#functions
def mesg():
    messagebox.showinfo("Tip", "error")

def add():
    
    tree.insert(parent='', index='end', iid=count, values=(ie2.get(), ie3.get(), ie4.get(), ie5.get()))
    count += 1
  

#frame for Input data
input_frame = LabelFrame(main, height=370, width=1320, text='Input')
input_frame.grid(row = 0, column=0 )
# Input labels and entry boxes
i1 = Label(input_frame, text="parent name:")
i1.grid(row=0, column=0,padx=5,pady=5)
ie1 = Entry(input_frame, width = 50)
ie1.grid(row=0, column=1,padx=5,pady=5)
i2 = Label(input_frame, text="child:")
i2.grid(row=1, column=0,padx=5,pady=5)
ie2 = Entry(input_frame, width= 50)
ie2.grid(row=1, column=1,padx=5,pady=5)
i3 = Label(input_frame, text="garndchild:")
i3.grid(row=2, column=0,padx=5,pady=5)
ie3 = Entry(input_frame, width= 50)
ie3.grid(row=2, column=1,padx=5,pady=5)
i4 = Label(input_frame, text="a:")
i4.grid(row=3, column=0,padx=5,pady=5)
ie4 = Entry(input_frame, width= 50)
ie4.grid(row=3, column=1,padx=5,pady=5)
i5 = Label(input_frame, text="b")
i5.grid(row=4, column=0,padx=5,pady=5)
ie5 = Entry(input_frame, width= 50)
ie5.grid(row=4, column=1,padx=5,pady=5)
i6 = Label(input_frame, text="c")
i6.grid(row=5, column=0,padx=5,pady=5)
ie6 = Entry(input_frame, width= 50)
ie6.grid(row=5, column=1,padx=5,pady=5)
#button
add_data = Button(input_frame, text ="Add data", command=add)
add_data.grid(row = 8, column = 2,padx=10,pady=10)
#frame for tree view
tree_frame = LabelFrame(main, height=310, width=1335, text='tree table', padx=5,pady=5)
tree_frame.grid(row = 1,column=0, padx=5,pady=3 )
#treeview style
style = ttk.Style()
style.configure("Tree view.Heading", font=('Times new roman',11, 'bold')  )
style.theme_use('clam')
#treeview
tree = ttk.Treeview(tree_frame)
tree.pack()
#define columns
tree('columns') = ("child", "grandchild", "a","b","c")
#Formate column
tree.column("#0",width=100)
tree.column("child",anchor=W,width=100)
tree.column("grandchild",anchor=W,width=100)
tree.column("a",anchor=W,width=120)
tree.column("b",anchor=W,width=120)
tree.column("b",anchor=W,width=120)
#create Heading
tree.heading("#0",text='parent',anchor=W)
tree.heading("child",text='child',anchor=W)
tree.heading("grandchild", text='grandchild', anchor=W)
tree.heading("a", text='a',anchor=W)
tree.heading("b",text='b',anchor=W)
tree.heading("c",text='c',anchor=W)
main.mainloop()