#include <bits/stdc++.h> using namespace std; int main() { int T = 0; cin >> T; while(T--){ int n = 0; cin >> n; vector<int> num(n); for(int i = 0; i < n; i++){ cin >> num[i]; } vector<vector<int>> circle(n-1, vector<int>(2)); for(int i = 0; i < n - 1; i++){ circle[i][0] = min(num[i], num[i + 1]); circle[i][1] = max(num[i], num[i + 1]); } int flag = 0; for(int i = 0; i < n - 1; i++){ for(int j = 0; j < i; j++){ if((circle[i][0] < circle[j][0] && circle[i][1] > circle[j][0] && circle[i][1] < circle[j][1]) || (circle[i][0] > circle[j][0] && circle[i][0] < circle[j][1] && circle[i][1] > circle[j][1])){ flag = 1; break; } if(flag) break; } } if(flag) cout << "y" <<endl; else cout << "n" << endl; } return 0; } // 64 位输出请用 printf("%lld")