You can use list comprehensions:
In [23]: ls = [[5,3,2,7,1],[3,5,6,8,9,21,2],[5,3,6,7,3,9],]
In [24]: l = len(ls)
In [25]: [list(range(s,s+l)) for s in ls[0] if all(i in l for i,l in zip(range(s+1,s+l),ls[1:]))]
Out[25]: [[5, 6, 7], [7, 8, 9], [1, 2, 3]]
The gust of it is, for every number in the first list generate a sequence of incremented numbers and check if each one is contained in the corresponding list in the sequence of remaining lists.
Note that all
stops iterating over the generator expression as soon as a condition is not satisfied, improving the efficiency of the method.
For a LARGE instance of the problem, it may be worth to convert all the lists to sets before the list comprehension, ls = [set(l) for l in ls]
Addendum
A variation w/o list comprehension using a for
loop and a conditional statement, note that the inner lists were converted to sets before the search for sequences.
ls = [[5, 3, 2, 7, 1], [3, 5, 6, 8, 9, 21, 2], [5, 3, 6, 7, 3, 9]]
l = len(ls)
ls = [set(li) for li in ls]
candidates = []
for n in ls[0]:
if all(i in l for i, l in zip(range(n+1, n+l), ls[1:])):
candidates.append(list(range(n, n+l)))