I am not able to remove TLE error from this. Here are the original constraints for the problem.

1≤T≤1,000

1≤N≤105

1≤Ai≤N for each valid i

the sum of N over all test cases does not exceed 2⋅10^5.

```
def happy(L):
for i in range(1,len(L)-1):
j=i+1
while j<len(L):
if L*==L[j]:
if str(i) in L and str(j) in L:
return "Truly Happy"
j=j+1
return "Poor Chef"
```

x=int(input())

list=[]

for i in range(x):

y=int(input())

z=input().split()

z.insert(0,0.3)

list.append(z)

for i in list:

print(happy(i))

Sub-Task Task # Result

(time)

1 0 AC

(0.020000)

Subtask Score: 27.00% Result - AC

2 1 AC

(0.020000)

2 2 TLE

(5.010000)

2 3 TLE

(5.010000)

Subtask Score: 0.00% Result - TLE

Total Score = 27.00%

I have tried to think about other algorithms but cant find better than this. Maybe problem lies in the input part, which increases time.