a = [1, 0, 2, 5, 4, 3, 1]
b = [1, 2, 5, 4, 3, 0, 1]
c = [1, 3, 5, 4, 2, 0, 1]

def longest_match_finder(lists):
    matches = []
for a in lists:
    lengths = set()
for leng in range(1, len(a) + 1):
    lengths = lengths | set(tuple(a[i:i + leng]) for i in range(len(a) -
        leng + 1))
matches.append(lengths)
return max(set.intersection(*matches), key=len)
print(longest_match_finder([a, b, c]))
5, 4
how to intersect lists in python with respect to index