VR
Size: a a a
VR
V
S
ІО
ІО
Q
ІО
AM
MP
AM
MP
AM
S
AM
def make_map(list_child_parent):
has_parent = set()
all_items = {}
for child, parent in list_child_parent:
if parent not in all_items:
all_items[parent] = {}
if child not in all_items:
all_items[child] = {}
all_items[parent][child] = all_items[child]
has_parent.add(child)
result = {}
for key, value in all_items.items():
if key not in has_parent:
result[key] = value
return result
AM
AM
ВЗ
AM
AP
SG