"What do you know about happiness?" — Yoda 
Chef is happy only if three conditions hold:
- Chef finished cooking a delicious meal
- Chef got AC for a programming problem with an almost correct code
- Chef got a new problem with a sequence of integers
Today, all three conditions are satisfied. Chef would like you to feel his happiness and provide him with a solution for this new problem with a sequence of integers. The problem is as follows.
You are given a sequence $A_1, A_2, \dots, A_N$. You need to determine if it is possible to choose two indices $i$ and $j$ such that $A_i \neq A_j$, but $A_{A_i}$ = $A_{A_j}$. (If it was possible, Chef would be truly happy.)

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing the string "Truly Happy" if it is possible to choose required indices or "Poor Chef" otherwise.

-----Constraints-----
- $1 \le T \le 1,000$
- $1 \le N \le 10^5$
- $1 \le A_i \le N$ for each valid $i$
- the sum of $N$ over all test cases does not exceed $2 \cdot 10^5$

-----Subtasks-----
Subtask #1 (27 points): $1 \le N \le 1,000$
Subtask #2 (73 points): original constraints

-----Example Input-----
4
4
1 1 2 3
4
2 1 3 3
5
5 4 4 3 1
5
3 2 1 1 4

-----Example Output-----
Truly Happy
Poor Chef
Poor Chef
Truly Happy

-----Explanation-----
Example case 1: Chef is truly happy because $A_{A_3} = A_{A_1}$ and $A_3 \neq A_1$.
Example case 2: There is no pair of indices which would make Chef truly happy. For instance, $A_{A_3} = A_{A_4}$, but $A_3 = A_4$,

Source: codechef | Difficulty: MEDIUM
Tags: Data structures

Implementation


Solutions:
t = int(input())
for _ in range(t):
	N = int(input())
	dict1 = {}
	flag = False
	S = [int(x) for x in input().split()]
	for i in range(N):
		if S[i] in dict1.keys():
			dict1[S[i]].append(i + 1)
		else:
			dict1[S[i]] = [i + 1]
	for (key, val) in dict1.items():
		if len(val) == 1:
			continue
		count = 0
		for e in val:
			if e in dict1.keys():
				count += 1
			if count == 2:
				flag = True
				break
		if flag == True:
			break
	if flag == True:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
for i in range(t):
	d = {}
	n = int(input())
	l = list(map(int, input().strip().split(' ')))
	for j in range(1, len(l) + 1):
		if l[j - 1] in d:
			d[l[j - 1]].append(j)
		else:
			d[l[j - 1]] = [j]
	f = 0
	for k in d:
		if len(d[k]) < 2:
			continue
		av = list(set(d[k]) - (set(d[k]) - set(d.keys())))
		if len(av) >= 2:
			print('Truly Happy')
			f = 1
			break
	if f == 0:
		print('Poor Chef')


for _case in range(int(input())):
	N = int(input())
	seqx = ['h'] + [int(x) for x in input().split()]
	dicx = {}
	for (idx, val) in enumerate(seqx):
		dicx.setdefault(val, []).append(idx)
	dicx.pop('h')
	found = False
	for v in dicx.values():
		if found:
			break
		if len(v) > 1:
			countw = 0
			for y in v:
				if y in dicx:
					countw += 1
			if countw >= 2:
				found = True
				break
	if found:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	A = set(arr)
	B = set((arr[i - 1] for i in A))
	if A == B:
		print('Poor Chef')
	else:
		print('Truly Happy')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	for i in range(n):
		if a[i] in d:
			d[a[i]].append(i + 1)
		else:
			d[a[i]] = [i + 1]
	f = 1
	for j in d.keys():
		c = 0
		for k in range(len(d[j])):
			if d[j][k] in d.keys():
				c += 1
		if c >= 2:
			print('Truly Happy')
			f = 0
			break
	if f == 1:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	status = False
	if n == 1:
		print('Poor Chef')
	else:
		for i in range(n):
			a = arr[i]
			for j in range(i + 1, n):
				b = arr[j]
				if a != b and arr[a - 1] == arr[b - 1]:
					status = True
					break
			if status == True:
				break
		if status == True:
			print('Truly Happy')
		else:
			print('Poor Chef')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	fl = 0
	s = set(a)
	y = set((a[h - 1] for h in s))
	if len(y) < len(s):
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	aur = set(arr)
	aaur = set((arr[x - 1] for x in arr))
	if len(aaur) < len(aur):
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
while t != 0:
	n = int(input())
	a = [int(i) for i in input().split()]
	t = t - 1
	flag = 0
	b = set(a)
	b = list(b)
	if len(b) == len(a):
		print('Poor Chef')
		continue
	for i in range(len(b)):
		for j in range(i + 1, len(b)):
			if a[b[i] - 1] == a[b[j] - 1]:
				print('Truly Happy')
				flag = 1
				break
		if flag == 1:
			break
	if flag != 1:
		print('Poor Chef')


def success(l):
	d = {}
	d1 = {}
	for i in l:
		d1[i] = 1
	c = 0
	for i in l:
		c += 1
		if c in d1:
			d[i] = d.get(i, 0) + 1
			if d[i] == 2:
				return 'Truly Happy'
	return 'Poor Chef'
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	print(success(l))


t = int(input())
while t > 0:
	t = t - 1
	n = int(input())
	L = [int(i) - 1 for i in input().split()]
	d = {}
	for i in range(n):
		d[L[i]] = L[L[i]]
	f = [0] * (max(L) + 1)
	a = sorted(d.values())
	fl = 0
	for i in range(1, len(a)):
		if a[i] == a[i - 1]:
			fl = 1
			break
	if fl:
		print('Truly Happy')
	elif fl == 0:
		print('Poor Chef')


t = int(input())
for i in range(t):
	n = int(input())
	a = map(int, input().split())
	a_l = list(a)
	flag = False
	a_map = {}
	for (i, v) in enumerate(a_l):
		if v in a_map.keys():
			a_map[v][0] += 1
			a_map[v][1].append(i + 1)
		else:
			a_map[v] = [1, [i + 1]]
	for (k, v) in a_map.items():
		if v[0] == 1:
			continue
		else:
			indexes = v[1]
			count = 0
			for ind in indexes:
				if ind in a_map.keys():
					count += 1
					if count == 2:
						flag = True
						break
			if flag:
				break
	if flag:
		print('Truly Happy')
	else:
		print('Poor Chef')
exit(0)


try:
	t = int(input())
	for i in range(t):
		n = int(input())
		z = 0
		a = [int(j) for j in input().split(' ')]
		for k in range(n - 1):
			for x in range(k + 1, n):
				if a[k] != a[x]:
					if a[a[k] - 1] == a[a[x] - 1]:
						print('Truly Happy')
						z = 1
						break
			if z == 1:
				break
		if z == 0:
			print('Poor Chef')
except:
	pass


t = int(input())
for h in range(t):
	l = int(input())
	li = list(map(int, input().split()))
	li.insert(0, 0)
	status = True
	for i in range(1, len(li)):
		for j in range(1, len(li)):
			if i != j and li[i] != li[j]:
				if li[li[i]] == li[li[j]]:
					print('Truly Happy')
					status = False
					break
		if not status:
			break
	if status:
		print('Poor Chef')


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split(' ')))
	d = {}
	k = {}
	for i in a:
		k[i] = 1
	flag = 0
	for i in range(len(a)):
		if d.get(a[i], 0) == 0:
			d[a[i]] = [i + 1]
		else:
			d[a[i]].append(i + 1)
	for i in list(d.keys()):
		c = 0
		for j in d[i]:
			if k.get(j, 0) == 1:
				c += 1
		if c >= 2:
			flag = 1
			break
	if flag == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')
	t -= 1


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ln1 = len(set(l))
	l1 = []
	for i in l:
		l1.append(l[i - 1])
	ln2 = len(set(l1))
	if ln1 == ln2:
		print('Poor Chef')
	else:
		print('Truly Happy')


t = int(input())
while t > 0:
	n = int(input())
	a = [int(o) for o in input().split()]
	b = list(set(a))
	subarr = [0] * len(b)
	for i in range(len(b)):
		subarr[i] = a[b[i] - 1]
	flag = 0
	if len(subarr) != len(set(subarr)):
		flag = 1
	if flag == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')
	t -= 1


import numpy as np
T = int(input())
for i in range(T):
	N = int(input())
	appearances = [0] * N
	lst = [int(x) for x in input().split()]
	l = np.array(lst)
	unique = set(lst)
	for i in lst:
		appearances[i - 1] += 1
	cnt = False
	for i in range(N):
		if appearances[i] > 1:
			val = i + 1
			temp = np.where(l == val)[0]
			temp += 1
			if len(np.intersect1d(temp, l)) >= 2:
				print('Truly Happy')
				cnt = True
				break
	if cnt == False:
		print('Poor Chef')


from collections import defaultdict
x = int(input())
for __ in range(x):
	n = int(input())
	a = list(map(int, input().split()))
	d = defaultdict(list)
	for i in range(n):
		d[a[i]].append(i)
	b = set(a)
	for i in b:
		c = 0
		if len(d[i]) > 1:
			for j in d[i]:
				if len(d[j + 1]) > 0:
					c += 1
				if c == 2:
					break
		if c == 2:
			break
	if c == 2:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(x) for x in input().split()]
	flag = 0
	d = {}
	for i in range(n):
		if a[i] in d.keys():
			d[a[i]].append(i + 1)
		else:
			d[a[i]] = [i + 1]
	for x in d.values():
		if flag == 1:
			break
		elif len(x) != 1:
			y = len(x)
			for i in range(y - 1):
				if x[i] in d.keys():
					for j in range(i + 1, y):
						if x[j] in d.keys():
							print('Truly Happy')
							flag = 1
							break
				if flag == 1:
					break
	if flag == 0:
		print('Poor Chef')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if a[i] - 1 not in d:
			d[a[i] - 1] = [i]
		else:
			d[a[i] - 1].append(i)
	ans = False
	d1 = {}
	for i in d:
		if ans == True:
			break
		for j in d:
			if i != j:
				if a[i] == a[j] and i != j:
					ans = True
					break
	if ans == True:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	(size, count, ans) = (int(input()), 0, False)
	arr = list(map(int, input().split()))
	if len(set(arr)) == len(arr):
		count = 1
	if count == 1:
		print('Poor Chef')
	if count == 0:
		arr.insert(1, arr[0])
		for i in range(1, max(arr) + 1):
			for j in range(1, max(arr) + 1):
				if i == j:
					continue
				elif arr[i] == arr[j]:
					if i in arr and j in arr:
						ans = True
						break
			if ans == True:
				break
		print('Truly Happy') if ans == True else print('Poor Chef')


from collections import defaultdict
numTest = int(input())
for _ in range(numTest):
	n = int(input())
	arr = list(map(int, input().split()))
	db = defaultdict(list)
	uniq = set(arr)
	for (idx, num) in enumerate(arr):
		db[num].append(idx + 1)
	for idxl in db.values():
		c = 0
		for i in idxl:
			if i in uniq:
				c += 1
			if c == 2:
				print('Truly Happy')
				break
		else:
			continue
		break
	else:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = 'Poor Chef'
	for i in range(n):
		for j in range(i + 1, n):
			if l[i] == l[j]:
				if i + 1 in l and j + 1 in l:
					ans = 'Truly Happy'
	print(ans)


n = int(input())
for k in range(0, n):
	h = int(input())
	a = [int(x) for x in input().split()]
	s = list(set(a))
	l = 0
	if len(s) == len(a):
		print('Poor Chef')
	else:
		for i in range(0, len(s)):
			if l == 1:
				break
			else:
				for j in range(i + 1, len(s)):
					if a[s[i] - 1] == a[s[j] - 1]:
						l = 1
						break
		if l == 1:
			print('Truly Happy')
		else:
			print('Poor Chef')


for t in range(int(input())):
	n = int(input())
	l = [int(k) for k in input().split()]
	arr = []
	for i in range(n):
		arr.append([])
	ans = 'Poor Chef'
	for i in range(n):
		arr[l[i] - 1].append(i + 1)
	for i in range(n):
		ctr = 0
		for j in arr[i]:
			if len(arr[j - 1]) > 0:
				ctr = ctr + 1
		if ctr >= 2:
			ans = 'Truly Happy'
			break
	print(ans)


t = int(input())
for ty in range(t):
	n = int(input())
	arr1 = [int(x) for x in input().split()]
	grap = {}
	for i in range(n):
		if arr1[i] not in grap:
			grap[arr1[i]] = []
			grap[arr1[i]].append(i + 1)
		else:
			grap[arr1[i]].append(i + 1)
	flag = 0
	for key in grap:
		cnt = 0
		for i in range(len(grap[key])):
			if grap[key][i] in grap:
				cnt += 1
			if cnt == 2:
				flag = 1
				break
		if flag == 1:
			break
	if flag == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, -1)
	dict = {}
	for i in range(1, n + 1):
		if a[i] in dict:
			dict[a[i]].append(i)
		else:
			dict[a[i]] = [i]
	fl = False
	for x in dict.keys():
		if len(dict[x]) == 1:
			continue
		l = dict[x]
		for j in range(len(l)):
			if l[j] in dict:
				for k in range(j + 1, len(l)):
					if l[k] in dict:
						print('Truly Happy')
						fl = True
						break
				else:
					break
			if fl:
				break
		if fl:
			break
	else:
		print('Poor Chef')


for _ in range(int(input())):
	a = int(input())
	array = list(map(int, input().split()))
	common = list()
	for x in array:
		if array.count(x) > 1:
			common.append(x)
	if len(common) == 0:
		print('Poor Chef')
		continue
	ind = dict()
	for x in common:
		if x not in ind:
			ind[x] = list()
		for y in range(len(array)):
			if array[y] == x:
				ind[x].append(y + 1)
	flag = 0
	for x in ind:
		lis = ind[x]
		for m in lis:
			for n in lis:
				if m != n and m in array and (n in array):
					print('Truly Happy')
					flag = 1
					break
			if flag == 1:
				break
		if flag == 1:
			break
	else:
		if flag == 0:
			print('Poor Chef')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	seti1 = set(arr)
	l = [arr[i - 1] for i in arr]
	seti2 = set(l)
	if len(seti1) <= len(seti2):
		print('Poor Chef')
	else:
		print('Truly Happy')


import numpy as np
t = int(input())
while t > 0:
	n = int(input())
	lst = np.array([int(x) for x in input().split()])
	s = set(lst)
	for i in s:
		ind = np.where(lst == i)[0]
		count = 0
		if len(ind) > 1:
			for j in ind:
				if j + 1 in s:
					count = count + 1
					if count == 2:
						break
		if count == 2:
			break
	if count == 2:
		print('Truly Happy')
	else:
		print('Poor Chef')
	t = t - 1


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	d = sorted(a)
	b = [0] * 100001
	c = [0] * 100001
	for j in range(n):
		b[a[j]] = b[a[j]] + 1

		def bin(d, a, b, c):
			if b >= a:
				m = a + int((b - a) / 2)
				if d[m] == c:
					return 1
				elif d[m] > c:
					return bin(d, a, m - 1, c)
				else:
					return bin(d, m + 1, b, c)
			else:
				return 0
		bi = bin(d, 0, n - 1, j + 1)
		if bi == 1:
			c[a[j]] = c[a[j]] + 1
	r = 0
	for j in range(n):
		if b[a[j]] >= 2 and c[a[j]] >= 2:
			r = 1
			break
	if r == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = dict()
	l = list()
	for x in input().split():
		x = int(x)
		arr[x] = 1
		l.append(x)
	keys = list(arr)
	freq = dict()
	flag = 0
	for i in keys:
		if i <= len(l):
			if l[i - 1] not in freq:
				freq[l[i - 1]] = 1
			else:
				flag = 1
				break
	if flag == 0:
		print('Poor Chef')
	else:
		print('Truly Happy')


for i in range(int(input())):
	input()
	l = list(map(int, input().split(' ')))
	dict = {}
	for (indx, val) in enumerate(l):
		dict.setdefault(val, []).append(indx + 1)
	found = False
	for v in dict.values():
		if found:
			break
		if len(v) > 1:
			c = 0
			for y in v:
				if y in dict:
					c += 1
			if c >= 2:
				found = True
				break
	if found:
		print('Truly Happy')
	else:
		print('Poor Chef')


for z in range(int(input())):
	n = int(input())
	inpar = [int(x) for x in input().split(' ')]
	inpar = [0] + inpar
	ar = [[] for j in range(n + 1)]
	for j in range(1, n + 1):
		k = inpar[j]
		m = inpar[k]
		ar[m].append(k)
	flag = 0
	for i in range(1, n + 1):
		if ar[i]:
			for j in range(1, len(ar[i])):
				if ar[i][0] != ar[i][j]:
					flag = 1
			if flag == 1:
				break
	if flag == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')


ans = ['Poor Chef', 'Truly Happy']
for ti in range(int(input())):
	dic = {}
	n = int(input())
	ays = list(map(int, input().split()))
	uniq = set(ays)
	throw = set([ays[i - 1] for i in uniq])
	print(ans[len(throw) < len(uniq)])


t = int(input())
res = []
for _ in range(t):
	d = {}
	n = int(input())
	a = list(map(int, input().split()))
	for i in a:
		el = a[i - 1]
		if el in d:
			if d[el] != i:
				res.append('Truly Happy')
				break
		else:
			d[el] = i
	else:
		res.append('Poor Chef')
for i in res:
	print(i)


for _ in range(int(input())):
	n1 = int(input())
	a = list(map(int, input().split()))
	sep = {}
	if n1 < 10000:
		fnd = 0
		l = [0]
		l.extend(a)
		for i in range(1, n1 + 1):
			for j in range(i + 1, n1 + 1):
				if l[i] != l[j]:
					if l[l[i]] == l[l[j]]:
						fnd = 1
						break
		if fnd:
			print('Truly Happy')
		else:
			print('Poor Chef')
	elif n1 >= 10000:
		for i in range(n1):
			if a[i] not in sep.keys():
				sep[a[i]] = [i + 1]
			else:
				sep[a[i]].append(i + 1)
		fnd = 0
		for i in sep.keys():
			for j in range(1, len(sep[i])):
				if sep[i][j] in sep and i not in sep[sep[i][j]]:
					fnd = 1
					break
		if fnd:
			print('Truly Happy')
		else:
			print('Poor Chef')


y = int(input())
while y:
	n = int(input())
	li = list(map(int, input().split()))
	d = {key + 1: set() for key in range(n)}
	a = [0] * n
	for i in range(0, n):
		d[li[i]].add(i + 1)
		a[li[i] - 1] += 1
	z = 'u'
	for i in range(n):
		if a[i] > 1:
			c = d[i + 1]
			count = 0
			for i in c:
				if a[i - 1] != 0:
					count += 1
				if count >= 2:
					print('Truly Happy')
					z = 'done'
					break
		if z == 'done':
			break
	else:
		print('Poor Chef')
	y -= 1


def solve(A, n):
	for i in range(n):
		for j in range(n):
			if i != j:
				if A[i] == A[j]:
					if i + 1 in A and j + 1 in A:
						return True
	return False
try:
	T = int(input())
	for l in range(T):
		n = int(input())
		path = [int(i) for i in input().strip().split(' ')]
		if solve(path, n):
			print('Truly Happy')
		else:
			print('Poor Chef')
except EOFError:
	pass


t = int(input())
for i in range(t):
	z = 0
	n = int(input())
	l = list(map(int, input().split()))
	l.insert(0, 0)
	k = []
	for i in range(1, len(l)):
		k.append((l[l[i]], l[i]))
	m = []
	k = set(k)
	for i in k:
		m.append(i[0])
	if len(m) - len(set(m)) > 0:
		print('Truly Happy')
	else:
		print('Poor Chef')


T = int(input())
for i in range(T):
	N = int(input())
	seq = [int(s) for s in input().split()]
	ans = 0
	for i in range(len(seq)):
		a = seq[i]
		c = seq[a - 1]
		for j in range(i + 1, len(seq)):
			b = seq[j]
			d = seq[b - 1]
			if a != b and c == d:
				ans = 1
				break
		if ans == 1:
			break
	if ans == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	size = int(input())
	numbers = list(map(int, input().split()))
	ind = {}
	for (i, j) in enumerate(numbers):
		if j in ind:
			ind[j].append(i + 1)
		else:
			ind[j] = [i + 1]
	ans = 'Poor Chef'
	set_keys = set(ind.keys())
	for (i, indexes) in ind.items():
		cnt = 0
		for j in indexes:
			if j in set_keys:
				cnt += 1
				if cnt == 2:
					ans = 'Truly Happy'
					break
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	dp = {}
	for i in range(n):
		if dp.get(a[i]):
			dp[a[i]].append(i + 1)
		else:
			dp[a[i]] = [i + 1]
	flag = 0
	for i in dp:
		count = 0
		for j in dp[i]:
			if dp.get(j):
				count += 1
		if count > 1:
			flag = 1
			break
	print('Truly Happy') if flag == 1 else print('Poor Chef')


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	hsh = set()
	hsh1 = set(arr)
	f = 0
	for i in range(1, n + 1):
		if i in hsh1:
			if arr[i - 1] in hsh:
				print('Truly Happy')
				f = 1
				break
			else:
				hsh.add(arr[i - 1])
	if not f:
		print('Poor Chef')
	t -= 1


test = int(input())
for k in range(test):
	N = int(input())
	A1 = list(map(int, input().split()))
	A2 = []
	for item in A1:
		A2.append(A1[item - 1])
	l1 = set(A1)
	l2 = set(A2)
	if len(l1) > len(l2):
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	input()
	array = [int(_) for _ in input().split()]
	map_array = dict()
	for (index, elememt) in enumerate(array):
		if array[elememt - 1] in map_array:
			map_array[array[elememt - 1]].append((index, elememt - 1))
		else:
			map_array[array[elememt - 1]] = [(index, elememt - 1)]
	(ans, a, b) = (False, 0, 0)
	for dist in map_array:
		(index, elememt) = map_array[dist][0]
		(f, a) = (False, index)
		for (index_, e_) in map_array[dist][1:]:
			if elememt != e_:
				(f, b) = (True, index_)
				break
		if f == True:
			ans = True
			break
	print('Truly Happy' if ans else 'Poor Chef')


for _ in range(0, int(input())):
	t = int(input())
	li = list(map(int, input().split()))
	l = list(set(li))
	l1 = []
	l2 = [0] * t
	flag = 1
	for i in range(0, len(l)):
		l1.append(li[l[i] - 1])
	for i in range(0, len(l1)):
		l2[l1[i] - 1] += 1
		if l2[l1[i] - 1] >= 2:
			print('Truly Happy')
			flag = 0
			break
		else:
			flag = 1
	if flag == 1:
		print('Poor Chef')


t = int(input())
while t:
	t -= 1
	check = 0
	N = int(input())
	A = [None] * (N + 1)
	s = 0
	move = dict()
	A = [int(x) for x in input().split()]
	for i in range(len(A)):
		s = A[A[i] - 1]
		move_v = move.get(s)
		if move_v == None:
			move_v = move.update({s: i})
		elif A[move_v] != A[i]:
			check = 1
	if check == 1:
		print('Truly Happy')
	elif check == 0:
		print('Poor Chef')
	else:
		pass


for _ in range(int(input().strip())):
	n = int(input().strip())
	ls = list(map(int, input().strip().split()))
	ls1 = dict()
	ls2 = dict()
	ans = 'Poor Chef'
	for i in ls:
		add = 0
		if i not in ls2:
			ls2[i] = 1
			add = 1
		if ls[i - 1] not in ls1:
			ls1[ls[i - 1]] = 1
		elif add == 1:
			ans = 'Truly Happy'
			break
	print(ans)


from collections import defaultdict
numTest = int(input())
for _ in range(numTest):
	n = int(input())
	arr = list(map(int, input().split()))
	db = defaultdict(int)
	uniq = set(arr)
	for (idx, num) in enumerate(arr):
		if idx + 1 in uniq:
			db[num] += 1
	for n in db.values():
		if n >= 2:
			print('Truly Happy')
			break
	else:
		print('Poor Chef')


n = int(input())
Incorrect = 'Poor Chef'
Correct = 'Truly Happy'
for i in range(n):
	input0 = int(input())
	e = []
	input1 = [int(i) for i in input().split()]
	d1 = set(input1)
	input2 = list(set(input1))
	for i in range(len(input2)):
		e.append(input1[input2[i] - 1])
	f1 = set(e)
	f = list(f1)
	count1 = len(f)
	count2 = len(e)
	if count1 == count2:
		print(Incorrect)
	else:
		print(Correct)


t = int(input())
while t > 0:
	n = int(input())
	ar = [int(i) for i in input().split()]
	m = {}
	for i in range(len(ar)):
		if ar[i] not in m:
			m[ar[i]] = []
		m[ar[i]].append(i + 1)
	s = set(ar)
	for i in m:
		indices = m[i]
		countPresent = 0
		for j in indices:
			if j in s:
				countPresent += 1
		if countPresent >= 2:
			print('Truly Happy')
			break
	else:
		print('Poor Chef')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	lst = []
	for i in range(n):
		lst.append([a[a[i] - 1], a[i]])
	lst.sort()
	f = 0
	for i in range(0, n - 1):
		if lst[i][0] == lst[i + 1][0] and lst[i][1] != lst[i + 1][1]:
			f = 1
			break
	if f == 0:
		print('Poor Chef')
	else:
		print('Truly Happy')


for _ in range(int(input())):
	d = {}
	n = int(input())
	l = [0]
	l += list(map(int, input().split()))
	for i in range(1, n + 1):
		if l[i] in d:
			d[l[i]].append(i)
		else:
			d[l[i]] = [i]
	for key in d:
		c = 0
		if len(d[key]) > 1:
			for j in range(len(d[key])):
				if d[key][j] in d:
					c += 1
				if c >= 2:
					break
		if c >= 2:
			break
	if c >= 2:
		print('Truly Happy')
	else:
		print('Poor Chef')


from sys import stdin
happy = compile('print("Truly Happy")', '<string>', 'exec')
sad = compile('print("Poor Chef")', '<string>', 'exec')
for test_case in range(int(stdin.readline())):
	stdin.readline()
	l = list(map(int, stdin.readline().split(' ')))
	_set = set(l)
	dict = {}
	for i in _set:
		dict.setdefault(l[i - 1], 0)
		dict[l[i - 1]] += 1
	temp = list(filter(lambda x: x > 1, dict.values()))
	if len(temp) == 0:
		exec(sad)
	else:
		exec(happy)


t = int(input())

def search(a, n, item):
	l = 0
	r = n - 1
	found = False
	while not found and l <= r:
		m = l + r >> 1
		if a[m] == item:
			found = True
		elif a[m] > item:
			r = m - 1
		else:
			l = m + 1
	return found
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	yes = 'Truly Happy'
	no = 'Poor Chef'
	check = []
	d = {}
	for i in range(n):
		d[i + 1] = []
	for i in range(n):
		d[a[i]].append(i + 1)
		if len(d[a[i]]) == 2:
			check.append(a[i])
	sa = sorted(a)
	for i in check:
		count = 0
		done = False
		for j in d[i]:
			if search(sa, n, j):
				count += 1
			if count == 2:
				done = True
				break
		if done:
			print(yes)
			break
	else:
		print(no)


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	s = set(arr)
	m = {}
	for (i, a) in enumerate(arr):
		if a not in m:
			m[a] = []
		m[a].append(i + 1)
	for a in m:
		count = 0
		for i in m[a]:
			if i in s:
				count += 1
			if count == 2:
				return 'Truly Happy'
	return 'Poor Chef'
tc = int(input())
for t in range(tc):
	print(solve())


for i in range(int(input())):
	c = 0
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(len(a)):
		for j in range(len(a)):
			try:
				if a[i] != a[j] and a[a[i] - 1] == a[a[j] - 1]:
					c += 1
				else:
					pass
			except:
				pass
	if c == 0:
		print('Poor Chef')
	else:
		print('Truly Happy')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = [0] * (n + 1)
	for i in a:
		m[i] = 1
	c = [0] * (n + 1)
	flag = False
	for i in range(n):
		if m[i + 1] == 1:
			if c[a[i]] != 0:
				flag = True
				break
			c[a[i]] = i + 1
	if flag:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
for i in range(0, t):
	n = int(input())
	l = list(map(int, input().split()))
	count1 = len(set(l))
	l1 = []
	for j in l:
		l1.append(l[j - 1])
	count2 = len(set(l1))
	if count1 == count2:
		print('Poor Chef')
	else:
		print('Truly Happy')


from collections import defaultdict
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	dd = defaultdict(list)
	boo = False
	se = set(a)
	for i in range(len(a)):
		if a[i] in se and a[a[i] - 1] in dd:
			for j in dd[a[a[i] - 1]]:
				if a[i] != j:
					boo = True
					break
		if boo:
			break
		dd[a[a[i] - 1]].append(a[i])
	if boo:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	A = [int(x) for x in input().split()]
	d = {}
	for i in range(n):
		if A[i] in d:
			d[A[i]].append(i + 1)
		else:
			d[A[i]] = [i + 1]
	(flag1, flag2) = (False, False)
	for i in d:
		(flag1, flag2) = (False, False)
		if len(d[i]) > 1:
			for j in d[i]:
				if j in d:
					if flag1:
						flag2 = True
					else:
						flag1 = True
				if flag1 and flag2:
					break
		if flag1 and flag2:
			break
	if flag1 and flag2:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	rev = {}
	for i in range(1, n + 1):
		if li[i - 1] not in rev:
			rev[li[i - 1]] = [i]
		else:
			rev[li[i - 1]].append(i)
	flag = 0
	for i in rev:
		if len(rev[i]) >= 2:
			co = 0
			for j in rev[i]:
				if j in rev:
					co = co + 1
				if co >= 2:
					flag = 1
					break
		if flag == 1:
			break
	if flag == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')


T = int(input())
while T > 0:
	N = int(input())
	Dict = {}
	CopyDict = {}
	L = list(map(int, input().split()))
	O = set([])
	for i in range(0, len(L)):
		if L[i] not in O:
			O.add(L[i])
		if L[i] in Dict:
			if i + 1 in Dict[L[i]]:
				Dict[L[i]].remove(i + 1)
			else:
				Dict[L[i]].add(i + 1)
				CopyDict[L[i]].add(i + 1)
		else:
			Dict[L[i]] = set([i + 1])
			CopyDict[L[i]] = set([i + 1])
	for i in Dict:
		if len(CopyDict[i]) < 2:
			CopyDict.pop(i)
	flag = -1
	for i in CopyDict:
		count = 0
		for j in CopyDict[i]:
			if j in O:
				count += 1
				if count >= 2:
					flag = 0
					break
	if flag == -1:
		print('Poor Chef')
	else:
		print('Truly Happy')
	T -= 1


for _ in range(int(input())):
	input()
	a = [-1] + list(map(int, input().split()))
	uni = set(a)
	maxi = max(uni)
	hash = [False] * (maxi + 1)
	flag = False
	for ele in (ele for ele in uni if ele != -1):
		if hash[a[ele]] is False:
			hash[a[ele]] = True
		else:
			flag = True
			break
	if flag is True:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 'Poor Chef'
	sa = set(a)
	l = [a[i - 1] for i in a]
	sb = set(l)
	if len(sa) > len(sb):
		ans = 'Truly Happy'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	a = [0]
	a.extend(list(map(int, input().split())))
	count = 0
	ai = {}
	aai = {}
	for i in range(n + 1):
		if a[a[i]] in aai:
			if a[i] in ai:
				continue
			else:
				count += 1
		else:
			aai[a[a[i]]] = 1
			ai[a[i]] = 1
	if count > 0:
		print('Truly Happy')
	else:
		print('Poor Chef')


for _ in range(int(input())):
	flag = 0
	n = int(input())
	a = list(map(int, input().split(' ')))
	b = [[] for _ in range(n + 1)]
	for i in range(n):
		q = a[i]
		b[q].append(i + 1)
	for i in range(1, n + 1):
		if flag == 2:
			break
		r = len(b[i])
		if r >= 2:
			flag = 0
			for j in b[i]:
				if len(b[j]) >= 1:
					flag += 1
				if flag == 2:
					break
	if flag == 2:
		print('Truly Happy')
	else:
		print('Poor Chef')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	index_dict = defaultdict(list)
	flag = False
	for i in range(n):
		index_dict[a[i]].append(i + 1)
	for (k, v) in index_dict.items():
		count = 0
		if len(v) >= 2:
			for i in v:
				if i in index_dict.keys():
					count += 1
				if count == 2:
					flag = True
					break
		if flag == True:
			break
	if flag:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	f = [0] * (n + 1)
	l.insert(0, 0)
	flag = True
	for i in range(1, n + 1, 1):
		src = l[i]
		tar = l[src]
		if f[tar] == 0:
			f[tar] = src
		elif f[tar] != src:
			flag = False
	if flag:
		print('Poor Chef')
	else:
		print('Truly Happy')


test = int(input())
while test != 0:
	n = int(input())
	a = list(map(int, input().split()))
	a1 = []
	for i in a:
		a1.append(a[i - 1])
	l1 = set(a)
	l2 = set(a1)
	if len(l1) > len(l2):
		print('Truly Happy')
	else:
		print('Poor Chef')
	test = test - 1


from sys import stdin
chefs_happiness = {True: 'Truly Happy', False: 'Poor Chef'}
outputs = []
for tc in range(int(stdin.readline())):
	N = int(stdin.readline())
	A = list(map(int, stdin.readline().strip().split(' ')))[:N]
	A_a_i = map(lambda x: A[x - 1], A)
	lookup = {}
	answer = False
	for (index, number) in enumerate(A_a_i):
		if number in lookup:
			if A[lookup[number]] != A[index]:
				answer = True
				break
			else:
				lookup[number] = index
		else:
			lookup[number] = index
	outputs.append(chefs_happiness[answer])
for _ in outputs:
	print(_)


def __starting_point():
	t = int(input())
	for q in range(t):
		n = int(input())
		l = list(map(int, input().split()))
		count = 0
		for i in range(n - 1):
			for j in range(i + 1, n):
				if l[i] != l[j]:
					if l[l[i] - 1] == l[l[j] - 1]:
						count += 1
						break
		if count == 0:
			print('Poor Chef')
		else:
			print('Truly Happy')
__starting_point()


for _ in range(int(input())):
	z = int(input())
	arr1 = list(map(int, input().split()))
	arr = [arr1[arr1[j] - 1] for j in range(len(arr1))]
	t1 = list(set(arr1))
	t2 = list(set(arr))
	if len(t1) != len(t2):
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(len(a)):
		d[a[i]] = 0
	for i in range(len(a)):
		if i + 1 in d:
			if d[a[i]] == 1:
				print('Truly Happy')
				break
			else:
				d[a[i]] = 1
	else:
		print('Poor Chef')


t = int(input())
for i in range(0, t):
	n = int(input())
	x = [int(y) for y in input().split()]
	s = set(x)
	l1 = list(s)
	le = len(l1)
	c = 0
	if len(x) == le:
		print('Poor Chef')
	else:
		for i in range(0, le):
			for j in range(i + 1, le):
				if x[l1[i] - 1] == x[l1[j] - 1]:
					c = 1
					break
			if c == 1:
				break
		if c == 1:
			print('Truly Happy')
		else:
			print('Poor Chef')


t = int(input())
for i in range(t):
	r = int(input())
	a = [int(x) for x in input().split()]
	a.insert(0, 0)
	b = [[0] for x in range(r + 1)]
	(ind, flag) = (0, 0)
	for i in a:
		b[i][0] = b[i][0] + 1
		b[i].append(ind)
		ind = ind + 1
	for i in range(r + 1):
		if b[i][0] >= 2:
			flag = 0
			for j in b[i][1:]:
				if b[j][0] != 0:
					flag = flag + 1
				if flag >= 2:
					print('Truly Happy')
					break
		if flag >= 2:
			break
	if flag <= 1:
		print('Poor Chef')


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	l = [0] + l
	temp = [-1] * 10 ** 5
	for i in l[1:]:
		f = 0
		if temp[l[i]] == -1:
			temp[l[i]] = i
		elif temp[l[i]] != i:
			f = 1
			print('Truly Happy')
			break
	if f == 0:
		print('Poor Chef')


t = int(input())
while t != 0:
	flag = False
	n = int(input())
	a = [int(x) for x in input().split()]
	position = [0] * n
	for (i, element) in enumerate(a):
		if position[a[element - 1] - 1] == 0:
			position[a[element - 1] - 1] = element
		elif position[a[element - 1] - 1] != element:
			flag = True
			break
	if flag:
		print('Truly Happy')
	else:
		print('Poor Chef')
	t -= 1


def f(rec, only_these):
	temp = list(only_these.keys())
	for i in temp:
		c = 0
		for j in only_these[i]:
			if rec[j]:
				c += 1
				if c > 1:
					return 'Truly Happy'
	return 'Poor Chef'
for tt in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	li.insert(0, 'anything')
	n += 1
	rec = {i: [] for i in range(n + 1)}
	c = 0
	u = 0
	if u > 100:
		c = 0
	for i in li[1:]:
		c += 1
		rec[i].append(c)
	only_these = {i: rec[i] for i in rec.keys() if len(rec[i]) > 1}
	print(f(rec, only_these))


from collections import defaultdict
t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().strip().split(' ')))
	d = defaultdict(set)
	for i in range(n):
		d[l[l[i] - 1]].add(l[i])
	f = 0
	for k in d.keys():
		if len(d[k]) > 1:
			print('Truly Happy')
			f = 1
			break
	if f == 0:
		print('Poor Chef')


t = int(input())
while t > 0:
	n = input()
	prev = dict()
	arr = list(map(int, input().split()))
	ans = 'Poor Chef'
	for i in range(len(arr)):
		curr = arr[arr[i] - 1]
		j = prev.get(curr)
		if j == None:
			prev.update({curr: i})
		elif arr[j] != arr[i]:
			ans = 'Truly Happy'
	print(ans)
	t = t - 1


for subodh in range(int(input())):
	(latkar, ho) = (int(input()), 0)
	lst = list(map(int, input().split()))
	maxindx = max(lst)
	if len(set(lst)) == len(lst):
		print('Poor Chef')
	else:
		lst.insert(1, lst[0])
		for i in range(1, maxindx + 1):
			for j in range(1, maxindx):
				if i == j:
					continue
				elif lst[i] == lst[j]:
					if i in lst and j in lst:
						ho = 1
						break
			if ho == 1:
				break
		print('Truly Happy') if ho == 1 else print('Poor Chef')


ans = ['Poor Chef', 'Truly Happy']
for ti in range(int(input())):
	n = int(input())
	ays = list(map(int, input().split()))
	unq = set(ays)
	aas = set((ays[a - 1] for a in unq))
	print(ans[len(aas) < len(unq)])


t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	a1 = []
	for i in b:
		a1.append(b[i - 1])
	if len(set(b)) > len(set(a1)):
		print('Truly Happy')
	else:
		print('Poor Chef')


count = int(input())
while count > 0:
	count = count - 1
	n = int(input())
	h1 = {}
	h2 = {}
	arr = list(map(int, input().split()))
	suc = False
	for x in arr:
		h1[x] = 1
	for (counter, x) in enumerate(arr):
		if x in h2 and counter + 1 in h1:
			suc = True
			break
		elif counter + 1 in h1:
			h2[x] = 1
	if suc is True:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
while t != 0:
	n = int(input())
	a = list(map(int, input().split()))[:n]
	happy = False
	for i in range(n - 1):
		for j in range(i + 1, n):
			if a[i] != a[j]:
				(k, r) = (a[i], a[j])
				if a[k - 1] == a[r - 1]:
					happy = True
					break
	if happy == True:
		print('Truly Happy')
	else:
		print('Poor Chef')
	t -= 1


from collections import defaultdict

def duplicates(a):
	dup = defaultdict(list)
	for (i, item) in enumerate(a):
		dup[item].append(i)
	return (locs for (key, locs) in dup.items() if len(locs) > 1)
for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a.insert(0, 0)
	f = 0
	for j in duplicates(a):
		if len(list(set(a).intersection(j))) >= 2:
			f = 1
			print('Truly Happy')
			break
	if f == 0:
		print('Poor Chef')


for _ in range(int(input())):
	n = int(input())
	p = 0
	l = [int(y) for y in input().split()]
	s = set(l)
	s1 = list(s)
	if len(s1) == len(l):
		print('Poor Chef')
		continue
	for i in range(len(s1)):
		for j in range(i + 1, len(s1)):
			if l[s1[i] - 1] == l[s1[j] - 1]:
				p = 1
				break
		if p == 1:
			break
	if p == 1:
		print('Truly Happy')
	else:
		print('Poor Chef')


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	f = 1
	s = list(set(a))
	p = []
	for i in s:
		p.append(a[i - 1])
	if len(set(p)) == len(s):
		print('Poor Chef')
	else:
		print('Truly Happy')