func_code_string: #include <bits/stdc++.h>   using namespace std;   using ll = int64_t;   using vll = vector<ll>;   using vvll = vector<vll>;   using pll = pair<ll, ll>;   using vpll = vector<pll>;   using vvpll = vector<vpll>;   bool sorted(int arr[], int n) {     bool f1 = 1, f2 = 1;     for (int i = 0; i < n - 1; i++) {       if (arr[i + 1] >= arr[i]) {         f1 = 0;         break;       }     }     for (int i = 0; i < n - 1; i++) {       if (arr[i + 1] <= arr[i]) {         f2 = 0;         break;       }     }     return f1 || f2;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     cout.tie(nullptr);     ;     cout.setf(ios::fixed);     cout.precision(32);     ;     int q;     cin >> q;     while (q--) {       int n;       cin >> n;       int arr[n];       for (int i = 0; i < n; i++) cin >> arr[i];       int index = -1;       for (int i = 0; i < n - 1; i++) {         if (abs(arr[i] - arr[i + 1]) != 1) {           index = i;           break;         }       }       if (index != -1) {         reverse(arr, arr + index + 1);         reverse(arr + index + 1, arr + n);       }       if (sorted(arr, n))         cout <<  YES  << endl;       else         cout <<  NO  << endl;     }     return 0;   }   