import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.StringTokenizer; import java.io.IOException; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top */ public class Solution { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; FastScanner in = new FastScanner(inputStream); PrintWriter out = new PrintWriter(outputStream); ImpressingTheBoss solver = new ImpressingTheBoss(); int testCount = Integer.parseInt(in.next()); for (int i = 1; i <= testCount; i++) solver.solve(i, in, out); out.close(); } static class ImpressingTheBoss { public void solve(int testNumber, FastScanner in, PrintWriter out) { int n = in.nextInt(); int[] a = in.nextIntArray(n); for (int i = 0; i < n; i++) { int[] b = a.clone(); for (int val = 0; val <= 3000; val++) { System.arraycopy(a, 0, b, 0, n); b[i] = val; boolean ok = true; for (int j = 0; j < n - 1; j++) { ok &= b[j] <= b[j + 1]; } if (ok) { out.println("YES"); return; } } } out.println("NO"); } } static class FastScanner { BufferedReader br; StringTokenizer st; public FastScanner(InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } public int nextInt() { return Integer.parseInt(next()); } public String next() { while (st == null || !st.hasMoreElements()) { String line = null; try { line = br.readLine(); } catch (IOException e) { } st = new StringTokenizer(line); } return st.nextToken(); } public int[] nextIntArray(int n) { int[] ret = new int[n]; for (int i = 0; i < n; i++) { ret[i] = nextInt(); } return ret; } } }