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):
    self.name = " "
    self.id = 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

4
Mary 1234

Issac 222

Peter 3333

Evan 444

3
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))
i=0
Studentlist={}
for count in range(numnodes):
  tkn=Lines(i+1).split()
  print(tkn)
  node = Student()
  node.name =tkn(0)
  node.id =tkn(1)
 
  Studentlist(tkn(0))=node.id  
  
numedges = int(Lines(5))