Iām lost

```
def switch(l,i):
if l[i] == 1:
l[i] = 2
elif l[i] == 2:
l[i] = 1
for t in range(int(input())):
g = int(input())
for j in range(g):
i, n, q = map(int,input().split())
# Round starts
coins = [i] * n # List of coins initialized
for k in range(n):
#print("k:",k,"Before:",coins)
for change in range(k+1):
switch(coins, change)
#print("k:",k,"After:",coins)
# Counting starts
heads = 0
tails = 0
for coin in coins:
if coin == 1:
heads += 1
elif coin == 2:
tails += 1
if q == 1:
print(heads)
elif q == 2:
print(tails)
```