const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void (async function () {
    // Write your code here
    while ((line = await readline())) {
        n = parseInt(line);
        while (n-- > 0) {
            m = parseInt(await readline());
            arr = await readline();
            arrs = arr.split(" ");
            var cir = new Array();
            for (let j = 0; j < m; j = j + 2) {
                let left = Math.min(arrs[j], arrs[j + 1]);
                let right = Math.max(arrs[j], arrs[j + 1]);
                cir.push([left, right]);
            }
            var flag = false;
            for (let i = 1; i < cir.length; i++) {
                for (let j = 0; j < i; j++) {
                    var left1 = Number(cir[i][0]);
                    var right1 = Number(cir[i][1]);
                    var left2 = Number(cir[j][0]);
                    var right2 = Number(cir[j][1]);
                    if ((left1 < left2) && (right1 < right2) && (right1 > left2)) {
                        flag = true;
                        break;
                    } else if (
                        (left1 > left2) &&
                        (right1 > right2) &&
                        (right2 > left1)
                    ) {
                        flag = true;
                        break;
                    }
                }
            }
            if (flag) {
                console.log("y");
            } else {
                console.log("n");
            }
        }
    }
})();