Help me in solving CNDY problem

My issue

i searched in array the repeated number using nested loop

My code

#include <stdio.h>

int main() {
	int t;
	scanf("%d",&t);
	while(t--){
	    int n,s=0,i,j;
	    scanf("%d",&n);
	    int a[n];
	    for(i=0;i<2*n;i++){
	        scanf("%d",&a[i]);
	    }
	  
	    for(i=0;i<2*n;i++){
	        s=0;
	        for(j=i+1;j<2*n;j++){
	            if(a[i]==a[j]){
	                s++;
	            }
	        }
	        if(s==2){
	            printf("NO\n");
	            break;
	        }
	    }
	    if(s<2){
	        printf("YES\n");
	    }
	    }
	}



Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/CNDY

actually i declared the array size as a[n but was taking inputs of size 2n
so changed to a[2
n]