regrading PERCAPTA

someone plz help me out that …plz

why am i getting RE?

its working for sample input and some random inputs i tried .

my solution: https://www.codechef.com/viewsolution/34657672

and solution is below:

import collections

```
def dfs(p):
visited.add(p)
temp.add(p+1)
for node in road[p]:
if(node not in visited and selected[node]):
dfs(node)
t=int(input())
for _ in range(t):
n,m=map(int,input().split())
income=list(map(int,input().split()))
pop=list(map(int,input().split()))
road=collections.defaultdict(list)
for __ in range(m):
a,b=map(int,input().split())
road[a-1].append(b-1)
road[b-1].append(a-1)
i=income[0]
p=pop[0]
# to find max per capita
for x in range(1,n):
if(i*pop[x]<p*income[x]):
i=income[x]
p=pop[x]
selected=[False]*n
# to select node with max per capita
for x in range(n):
if(pop[x]*i== income[x]*p):
selected[x]=True
visited=set()
ans=set()
for each in range(n):
if(each not in visited and selected[each]):
temp=set()
dfs(each)
if(len(temp)>len(ans)):
ans=temp
print(len(ans))
print(*ans)
```

@ssrivastava990 @satin1004 @sebastian @mahatejvarma @ashish_kaur @nikiitp18 @