Storing and retrieving student scores in three subjects
PEP 8, the official Python style guide, specifies four spaces per level of indentation.  Since whitespace is significant in Python, that is a pretty strong convention.

The challenge states that the first line contains N, the number of students.  So, don't call that value a in the code, and don't use the variable n to mean something else.  It's confusing.

The variable i is never used.  It is customary to use _ as the name of a "throwaway" variable whose value does not matter.

Clearing f and n at the end of the loop is cumbersome and unnecessary.  Avoid cryptic variable names like f and n whose meanings are not obvious.  Even names like nam and per are unnecessarily unfriendly.  (Learn from Ken Thompson's biggest regret.)

For this problem, there is no need to store the scores for each subject separately.  You can just store the average right away.

scores = {}
n = int(input())
for _ in range(n):
    line = input().split()
    name = line.pop(0)
    scores[name] = sum(float(score) for score in line) / len(line)
print("%.2f" % scores[input()])