#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const long long INF = 0x3f3f3f3f;
const long long MAXN = 1e3 + 10;
const long long mod = 1e9 + 7;
long long a[205];
void solve() {
  long long n;
  cin >> n;
  for (long long i = (1); i <= (n); ++i) cin >> a[i];
  long long cnt = 0;
  for (long long i = (1); i <= (n - 1); ++i) {
    if (abs(a[i] - a[i + 1]) == 1) cnt++;
  }
  if (abs(a[1] - a[n]) == 1) cnt++;
  if (cnt >= n - 1)
    cout << "YES\n";
  else
    cout << "NO\n";
}
signed main() {
  std::ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long _ = 1;
  cin >> _;
  for (long long i = 1; i <= _; ++i) {
    solve();
  }
  return 0;
}
