#include <stdio.h>
int is_permutation(int A[], int N) {
int count[N + 1]; // count array to store frequency of each number
for (int i = 1; i <= N; i++) {
count[i] = 0; // initialize count array
}
for (int i = 0; i < N; i++) {
if (A[i] < 1 || A[i] > N) {
return 0; // if any number is out of range, it's not a permutation
}
count[A[i]]++; // increment count for each number
}
for (int i = 1; i <= N; i++) {
if (count[i]!= 1) {
return 0; // if any number appears more than once, it's not a permutation
}
}
return 1; // if all conditions are met, it's a permutation
}
int main() {
int T;
scanf("%d", &T);
for (int i = 0; i < T; i++) {
int N;
scanf("%d", &N);
int A[N];
for (int j = 0; j < N; j++) {
scanf("%d", &A[j]);
}
if (is_permutation(A, N)) {
printf("YES\n");
} else {
printf("NO\n");
}
}
return 0;
}