#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int arr[n + 5];
    for (int c = 1; c <= n; c++) cin >> arr[c];
    bool posibil = false;
    int c = 1;
    while (arr[c] + 1 == arr[c + 1] && c < n) c++;
    if (c != n) c++;
    while (arr[c] + 1 == arr[c + 1] && c < n) c++;
    if (c == n) posibil = true;
    c = 1;
    while (arr[c] - 1 == arr[c + 1] && c < n) c++;
    if (c != n) c++;
    while (arr[c] - 1 == arr[c + 1] && c < n) c++;
    if (c == n) posibil = true;
    if (posibil == true)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
