def LIS(A):
n = len(A)
P = [[] for _ in range(n)]
for i in range(n):
temps = [[A[i]]]
for k in range(i):
if A[k] < A[i]:
temps.append(P[k] + [A[i]])
for temp in temps:
if len(temp) > len(P[i]):
P[i] = temp
LIS = []
for p in P:
if len(LIS) < len(p):
LIS = p
return LIS
x = [1, 2, 3, 2, 4, 1, 5, 2, 3, 4, 1, 9, 2, 2, 3, 1, 1, 0, 19, 3, 20]
print(LIS(x))