• + 0 comments
    import java.io.*;
    import java.math.*;
    import java.security.*;
    import java.text.*;
    import java.util.*;
    import java.util.concurrent.*;
    import java.util.function.*;
    import java.util.regex.*;
    import java.util.stream.*;
    import static java.util.stream.Collectors.joining;
    import static java.util.stream.Collectors.toList;
    
    public class sorted{
        public static void main(String args[]){
            Scanner sc=new Scanner(System.in);
            int t=sc.nextInt();
            for(int a=1;a<=t;a++){
                int c=0;
                int n=sc.nextInt();
                int arr[]=new int[n];
                for(int b=0;b<n;b++){
                    arr[b]=sc.nextInt();
                }
                 for(int i=0;i<n;i++){
                      for(int j=i+1;j<n;j++){
                          if(arr[i]>arr[j])
                          c++;
                      }
                 }
                 if(c%2==0)
                    System.out.println("YES");
                else
                    System.out.println("NO");
            }
        }
    }