This code is the answer to PERCAPTA

```
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
def dfs(u):
if v[u]:
return
v[u] = True
p.append(u + 1)
for x in graph[u]:
dfs(x)
for _ in range(int(input())):
n,m=map(int, input().split())
cap=list(map(int, input().split()))
pop=list(map(int, input().split()))
ratio=[cap[i]//pop[i] for i in range(n)]
graph=[[] for _ in range(n)]
for _ in range(m):
u,v=map(int, input().split())
graph[u-1].append(v-1)
graph[v-1].append(u-1)
maxratio=max(ratio)
v=[True for i in range(n)]
for i in range(n):
if ratio[i]==maxratio:
v[i]=False
ans=[]
p=[]
for u in range(n):
if not v[u]:
dfs(u)
if len(p)>len(ans):
ans=p
p=[]
print(len(ans))
print(*ans)
```