### My issue

It is showing that partially correct.I tried a lot in this.i couldnt find out the solution.So plz help me

### My code

```
from itertools import product
for t in range(int(input())):
n, q = map(int, input().split())
lst = list(map(int, input().split()))
if q <= n:
print(lst[q-1])
else:
q = q - n
j = 2
y = lst.count(0)
while q > 0:
s = n-y
for i in range(j-1):
s = s*n
if q-s > 0:
q = q - s
j += 1
else:
for i in sorted(product(lst, repeat=j)):
a = ''.join(list(map(str,i)))
if a[0] != '0':
q -= 1
if q == 0:
print(int(a))
break
```

Learning course: Python with Data structures

Problem Link: CodeChef: Practical coding for everyone