tests_dict = {'test 1': ['Manuel', 'Mariana', 'Filipa'], 'test 2': ['Manuel', 'Filipa', 'Mariana'], 'test 3': ['Mariana', 'Manuel', 'Filipa']}
peps_dict = {}
for test in tests_dict:
for indx, name in enumerate(tests_dict[test], 1):
peps_dict.setdefault(name,{})[test] = indx
print(peps_dict)
dGVzdHNfZGljdCA9IHsndGVzdCAxJzogWydNYW51ZWwnLCAnTWFyaWFuYScsICdGaWxpcGEnXSwgJ3Rlc3QgMic6IFsnTWFudWVsJywgJ0ZpbGlwYScsICdNYXJpYW5hJ10sICd0ZXN0IDMnOiBbJ01hcmlhbmEnLCAnTWFudWVsJywgJ0ZpbGlwYSddfQoKcGVwc19kaWN0ID0ge30KZm9yIHRlc3QgaW4gdGVzdHNfZGljdDoKICAgIGZvciBpbmR4LCBuYW1lIGluIGVudW1lcmF0ZSh0ZXN0c19kaWN0W3Rlc3RdLCAxKToKICAgICAgICBwZXBzX2RpY3Quc2V0ZGVmYXVsdChuYW1lLHt9KVt0ZXN0XSA9IGluZHgKcHJpbnQocGVwc19kaWN0KQ==
{'Mariana': {'test 3': 1, 'test 1': 2, 'test 2': 3}, 'Manuel': {'test 3': 2, 'test 1': 1, 'test 2': 1}, 'Filipa': {'test 3': 3, 'test 1': 3, 'test 2': 2}}