def find_same_name(a):
n = len(a)
result = set()
for i in range(0, n - 1):
for j in range(i + 1, n):
if a[i] == a[j]:
result.add(a[i])
return result
v = ['tom', 'jerry', 'david', 'chris', 'david', 'mickey', 'tom']
print(find_same_name(v))
def make_pair(a):
n = len(a)
result = set()
for i in range(0, n - 1):
for j in range(i + 1, n):
print(a[i] + '-' + a[j])
v = ['tom', 'mike', 'jerry']
make_pair(v)