data = {}
file_name = input("Enter student's data filename: ")


f = open(file_name, "rt")
# Read the whole file into list.
lines = f.readlines()
f.close()  
# Scan the file line by line.
for i in range(len(lines)):
        # Get the i'th line.
    line = lines[i]
        # Divide it into columns.
    columns= line.split()
        # There shoule be 3 columns - are they there?
    student = columns[0] + ' ' + columns[1]
        # Get points.
    points = float(columns[2])
    if student in data:
        data[student] += points
    else:
        data[student] = points
    # Print results.
with open("natija2.txt", "wt") as s:
    for student in sorted(data.keys()):
        s.write(student+'\t'+str(data[student])+"\n")