tests_dict = {'test 1': ['Manuel', 'Mariana', 'Filipa'], 'test 2': ['Manuel', 'Filipa', 'Mariana'], 'test 3': ['Mariana', 'Manuel', 'Filipa']}
peps_dict = {}
for n in (name for listN in tests_dict.values() for name in listN):
peps_dict[n] = {test: tests_dict[test].index(n) + 1 for test in tests_dict if n in tests_dict[test]}
print(peps_dict)
dGVzdHNfZGljdCA9IHsndGVzdCAxJzogWydNYW51ZWwnLCAnTWFyaWFuYScsICdGaWxpcGEnXSwgJ3Rlc3QgMic6IFsnTWFudWVsJywgJ0ZpbGlwYScsICdNYXJpYW5hJ10sICd0ZXN0IDMnOiBbJ01hcmlhbmEnLCAnTWFudWVsJywgJ0ZpbGlwYSddfQpwZXBzX2RpY3QgPSB7fQpmb3IgbiBpbiAobmFtZSBmb3IgbGlzdE4gaW4gdGVzdHNfZGljdC52YWx1ZXMoKSBmb3IgbmFtZSBpbiBsaXN0Tik6CglwZXBzX2RpY3Rbbl0gPSB7dGVzdDogdGVzdHNfZGljdFt0ZXN0XS5pbmRleChuKSArIDEgZm9yIHRlc3QgaW4gdGVzdHNfZGljdCBpZiBuIGluIHRlc3RzX2RpY3RbdGVzdF19CnByaW50KHBlcHNfZGljdCk=
{'Manuel': {'test 1': 1, 'test 2': 1, 'test 3': 2}, 'Mariana': {'test 1': 2, 'test 2': 3, 'test 3': 1}, 'Filipa': {'test 1': 3, 'test 2': 2, 'test 3': 3}}