def dfs(target):     res = []     queue = [target]     vis = set()     vis.add(target)     while queue:         cur = queue.pop()         res += children[cur]         if graph[cur]:             for next in graph[cur]:                 if next not in vis:                     vis.add(next)                     queue.append(next)     return res n = int(input()) graph = {} children = {} for _ in range(n):     a, b, c = input().split()     if b == 'subClassOf&(14030)#39;:         if c not in graph:             graph[c] = []             graph[c].append(a)         if a not in graph:             graph[a] = []     if b == 'instanceOf&(14029)#39;:         if c not in children:             children[c] = []         children[c].append(a) target = input() res = dfs(target) res.sort() for item in res:     print(item, end=' &(5528)#39;) Python版本写了一个,不知道有没有问题,大家伙儿帮忙看看?(我没参加考试不知道通过率是多少,看了题目自己做的)