class Student:
  name = None
  id = None
  gpa = None
  next = None # the "next-link" 
# Student specification ends here

# main program starts here
try: # open a file for input
  fin = open("students.txt")
  start = None # create an empty list
except:
  print("file not found")
  exit() # end the program NOW

# read and save the records
for lineFromFile in fin:
  aStudent = Student() # Step 1, create a node

  # Step 2, read its data fields
  aStudent.name = lineFromFile.strip()
  aStudent.id = int(fin.readline().strip())
  aStudent.gpa = float(fin.readline().strip())
  fin.readline() # skip the ---------- separator

  # Step 3, add new node to the list
  aStudent.next = start
  start = aStudent
fin.close() # done with the input file
       
# traverse the list and output
p = start
while p != None:
  print("Name = {:30}".format(p.name), end="") 
  print(" ID = {:07}".format(p.id), end="") 
  print(", gpa =", p.gpa)
  p = p.next