python – How to make a tree from data that is stored in dictionary

I have a class of Student and a file that have the list of the student and their details with their edges. How do I make them a tree?

Here is the Student Class

class Student:        
 def __init__(self): = " " = None
    self.right = None
    self.left = None  

The file contains those in text

The 4 and the 3 in the file is the number of student and number of edges respectively

Mary 1234

Issac 222

Peter 3333

Evan 444

Mary Isaac

Mary Peter

Issac Evan

i aready split the name and id and store it in dictionary.. how do I continue to loop on the edges and link them into a tree using self.right and self.left?

here is the code when splitting the student name and id and store it in a dictionary

Lines = file.readlines()
numnodes = int(Lines(0))
for count in range(numnodes):
  node = Student() =tkn(0) =tkn(1)
numedges = int(Lines(5))