Four players participate in the playoff tournament. The tournament is held according to the following scheme: the first player will play with the second, and the third player with the fourth, then the winners of the pairs will play in the finals of the tournament.It is known that in a match between two players, the one whose skill is greater will win. The skill of the $$$i$$$-th player is equal to $$$s_i$$$ and all skill levels are pairwise different (i. e. there are no two identical values in the array $$$s$$$).The tournament is called fair if the two players with the highest skills meet in the finals.Determine whether the given tournament is fair.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. A single line of test case contains four integers $$$s_1, s_2, s_3, s_4$$$ ($$$1 \le s_i \le 100$$$) — skill of the players. It is guaranteed that all the numbers in the array are different.

For each testcase, output YES if the tournament is fair, or NO otherwise.

NoteConsider the example:  in the first test case, players $$$2$$$ and $$$3$$$ with skills $$$7$$$ and $$$9$$$ advance to the finals;  in the second test case, players $$$2$$$ and $$$4$$$ with skills $$$5$$$ and $$$9$$$ advance to the finals. The player with skill $$$6$$$ does not advance, but the player with skill $$$5$$$ advances to the finals, so the tournament is not fair;  in the third test case, players $$$1$$$ and $$$3$$$ with skills $$$5$$$ and $$$8$$$ advance to the finals;  in the fourth test case, players $$$1$$$ and $$$3$$$ with skills $$$6$$$ and $$$3$$$ advance to the finals. The player with skill $$$5$$$ does not advance, but the player with skill $$$3$$$ advances to the finals, so the tournament is not fair.

var testCase=+readline()
for(var i=0;i<testCase;i++){
    var sequence=readline().split(" ").map(node=>+node),counter=0
    var a=sequence.slice(0,2)
    var b=sequence.slice(-2)
    var aMax=a.reduce((a,b)=>Math.max(a,b))
    var bMax=b.reduce((a,b)=>Math.max(a,b))

    a.forEach((node)=>node>bMax?counter++:null)
    b.forEach((node)=>node>aMax?counter++:null)

    counter>1?print("NO"):print("YES")
}

var a = readline();
var arr = [];
var s = 0;
var s1 = 0;
var s2 = 0;
var s3 = 0;
var f = 0;
var f1 = 0;
var f2 = 0;
var f3 = 0;
var d = 0;
for(var i = 0; i < a; i++){
    arr[i] = readline().split(' ').map(i=>Number(i));
    s=arr[i][0];
    s1=arr[i][1];
    s2=arr[i][2];
    s3=arr[i][3];
    if(s>s1){
        f=s;
    }else{
        f=s1;
    }
    if(s2>s3){
        f1=s2
    }else{
        f1=s3
    }
    if(f<f1){
        f2=f;
    }else{
        f2=f1;
    }
    for(var j = 0; j < arr[i].length; j++){
        if(f2<arr[i][j]){
            f3++;
        }
    }
    if(f3==1){
        print("YES")
    }else{
        print("NO")
    }
    f3=0;
}

test = readline();
while(test--) {
players = readline().split(" ").map((x) => parseInt(x));

winner1 = Math.max(players[0], players[1]);
winner2 = Math.max(players[2], players[3]);

players.sort((a, b) => a - b);

print(players[3] == Math.max(winner1,winner2) && players[2] == Math.min(winner1,winner2) ? "YES" : "NO")
}

var t = readline();
    for(var i = 0 ; i < t ; i++){
        var s = readline().split(' '),
        s1 = s.slice(0,2).sort( (a,b) => {return a - b}),
        s2 = s.slice(2,4).sort( (a,b) => {return a - b}),
        highestSkills = s.sort( (a,b) => {return a - b}).slice(2,4);
        winners = [s1[1],s2[1]].sort( (a,b) => {return a - b});
        if(winners.toString() == highestSkills.toString()){
            print('YES');
        }
        else{
            print('NO');
        }
    }

t = +readline();
while (t--) {
  x = readline().split(" ").map(Number);
  winner1 = Math.max(x[0], x[1]);
  winner2 = Math.max(x[2], x[3]);
  losser1 = Math.min(x[0], x[1]);
  losser2 = Math.min(x[2], x[3]);
  wouldBig = Math.min(winner1, winner2);
  wouldSmoll = Math.max(losser1, losser2);
  if (wouldBig > wouldSmoll) {
    print("YES");
  } else {
    print("NO");
  }
}

// 1535 A - Playoff equo

// number of test case
var numTests = parseInt( readline() );

for (var numTest = 0; numTest < numTests; numTest++) {

    // input data
    var nums = readline().split(' ').map( e => parseInt(e));

    // two player più forti non stiano nella stessa squadra
    if( Math.max( nums[0],nums[1] ) >= Math.min( nums[2],nums[3] )  && Math.max( nums[2],nums[3] ) >= Math.min( nums[0],nums[1] ) ){
        print('YES');
    } else {
        print('NO');
    }

}

var number = parseInt(readline());
var first = 0;
var second = 0;

for(var i = 0; i < number; i++) {
    var counter = 0;
    var foo = readline();
    var fooSplited = foo.split(" ")
    if(parseInt(fooSplited[0]) > parseInt(fooSplited[1])) {
        first = parseInt(fooSplited[0]);
    } else {
        first = parseInt(fooSplited[1]);
    }

    if(parseInt(fooSplited[2]) > parseInt(fooSplited[3])) {
        second = parseInt(fooSplited[2]);
    } else {
        second = parseInt(fooSplited[3])
    }

    if(first > parseInt(fooSplited[2]) || first > parseInt(fooSplited[3])) {
        counter++;
    }

    if(second > parseInt(fooSplited[0]) || second > parseInt(fooSplited[1])) {
        counter++;
    }

    if(counter == 2) {
        print("YES");
    } else {
        print("NO")
    }

}

function check_player() {

k = readline();

for (i = 0; i < k; i++) {

  res_arr = readline().split(' ');
  m = 0;

   res_arr = res_arr.map(arg => +arg);

  res_arr = [res_arr.slice(0, 2), res_arr.slice(2, 4)];

max1 = Math.max(res_arr[0][0], res_arr[0][1]);
max2 = Math.max(res_arr[1][0], res_arr[1][1]);

    if (max1 > max2) {

      min1 = Math.min(res_arr[0][0], res_arr[0][1]);

        if (max2 > min1) {

          print('Yes');

        } else {

          print('No');

        }

    } else {

      min2 = Math.min(res_arr[1][0], res_arr[1][1]);

        if (max1 > min2) {

            print('Yes');

        } else {

            print('No');

        }

    }

  }

}

check_player();

const arrMax = a => Math.max.apply(null, a);

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var p = readline().split(' ').map(d => parseInt(d));
  var p_s = [...p];
  p_s.sort((a, b) => b - a);
  var fair = p_s.slice(0, 2);
  var actual = [];
  actual.push(arrMax(p.slice(0, 2)), arrMax(p.slice(2, 4)));
  actual.sort((a, b) => b - a);
  print(fair[0] === actual[0] && fair[1] === actual[1]? 'YES': 'NO');
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split(" ").map(x => parseInt(x));
        let a = array[0]>array[1]?array[0]:array[1];
        let b = array[2]>array[3]?array[2]:array[3];
        a < b ?
        a > array[2] || a > array[3] ? console.log('YES'): console.log('NO'):
        b > array[0] || b > array[1] ? console.log('YES'): console.log('NO');
    }
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let input = '';
process.stdin.on('data', inputStdin => {
    input += inputStdin;
});
process.stdin.on('end', _ => {
    main(input);
});

function main(input) {
    var args = input.split("\n");
    const t = parseInt(args[0], 10);
    for (var i = 1; i <= t; i++) {
        var v = args[i].split(" ").map((n) => parseInt(n, 10));
        var v2 = v.concat();
        v2.sort(function (a, b) {
            if (a < b) return -1;
            if (a > b) return 1;
            return 0;
        });
        if (((v2[0] == v[0] && v2[1] == v[1])
            || (v2[0] == v[1] && v2[1] == v[0])
            || (v2[0] == v[2] && v2[1] == v[3])
            || (v2[0] == v[3] && v2[1] == v[2]))) {
            console.log("NO");
        } else {
            console.log("YES");
        }
    }
}

const os = require('os');

function winner(players_skills) {
    return Math.max(players_skills[0], players_skills[1])
}

function solution(input) {
    const champion = Math.max(winner(input.slice(0, 2)), winner(input.slice(2, 4)));
    const runner_up = Math.min(winner(input.slice(0, 2)), winner(input.slice(2, 4)));
    input.sort((a, b) => b - a);

    return input[0] === champion && input[1] === runner_up ? 'YES' : 'NO';
}

function parse(input_in_string) {
    return input_in_string.split(' ').map(Number);
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(os.EOL);
    const number_of_test_cases = Number(input.shift());
    for(let test_case = 1; test_case <= number_of_test_cases; test_case += 1) {
        console.log(solution(parse(input.shift())));
    }
});

module.exports = {solution}

const os = require('os');

function winner(players_skills) {
    return Math.max(...players_skills)
}

function looser(players_skills) {
    return Math.min(...players_skills)
}
function is_fair(semifinal_1, semifinal_2) {
    return winner(semifinal_1) > looser(semifinal_2) &&
        winner(semifinal_2) > looser(semifinal_1);
}

function solution(input) {
    return  is_fair(input.slice(0, 2), input.slice(2, 4))? 'YES' : 'NO';
}

function parse(input_in_string) {
    return input_in_string.split(' ').map(Number);
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(os.EOL);
    for(const _ of Array(Number(input.shift()))) {
        console.log(solution(parse(input.shift())));
    }
});

module.exports = {solution}

const os = require('os');

function winner(players_skills) {
    return Math.max(...players_skills)
}

function looser(players_skills) {
    return Math.min(...players_skills)
}
function is_fair(semifinal_1, semifinal_2) {
    return winner(semifinal_1) > looser(semifinal_2) &&
        winner(semifinal_2) > looser(semifinal_1);
}

function solution(input) {
    return  is_fair(input.slice(0, 2), input.slice(2, 4))? 'YES' : 'NO';
}

function parse(input_in_string) {
    return input_in_string.split(' ').map(Number);
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(os.EOL);
    const number_of_test_cases = Number(input.shift());
    for (let test_case = 1; test_case <= number_of_test_cases; test_case += 1) {
        console.log(solution(parse(input.shift())));
    }
});

module.exports = {solution}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL); /*your input text, split by lines*/
    for(j = 1; j <= lines[0]; j++){
        var a = lines[j].split(' ')
        var x = Math.min(a[0], a[1])
        var c = Math.max(a[2], a[3])
        var v = Math.min(a[2], a[3]);
        var z = Math.max(a[0], a[1]);
        if(x <= c && v <= z){
            console.log('YES')
        }else {
            console.log('NO')
        }
    }
    });
//2 - 2 % 0 + 1
//2 - 2 % 0 - (0 - 1)
//xcvz
//2, min, *
//[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]; '15'

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    for(var j = 1; j <= lines[0]; j++){
        var a = lines[j].split(' ');
        var x = Math.min(a[0],a[1]);
        var c = Math.max(a[2],a[3]);
        var v = Math.min(a[2],a[3]);
        var z = Math.max(a[0],a[1]);
        if (x <= c && v <= z){
            console.log('YES');
        } else{
            console.log("NO");
        }
    }
});

//xcvz

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {

const testcase=parseInt(readline());
let d=[];
for(let i=0;i<testcase;i++){

  let r=[];
  r.push(readline().split(" "));
  let x=Math.max(r[0][0],r[0][1]);
  let t=Math.min(r[0][0],r[0][1]);
  let z=Math.min(r[0][2],r[0][3]);
      let y=Math.max(r[0][2],r[0][3]);

      if(x>z && y>t) d.push("YES");

      else d.push("NO");

}
for(let i=0;i<testcase;i++){
  console.log(d[i]);

}

}

// Getting input via STDIN
const readline = require("readline");

const inp = readline.createInterface({
  input: process.stdin
});

const userInput = [];

inp.on("line", (data) => {
  userInput.push(data);
});

inp.on("close", () => {
  //start-here
  //Your code goes here … replace the below line with your code logic
var i=1;
 var t=userInput[0]
 while(i<=t)
 {
     dummy=userInput[i].split(' ')
     arr=dummy

     var bigger=Math.max(dummy[0],dummy[1])
     var bigger2=Math.max(dummy[2],dummy[3])

    arr.sort(function(a, b) {
  return a - b;
})
     var biggestno=arr[3]
     var biggestno2=arr[2]

     if(((bigger==biggestno)||(bigger==biggestno2))&&((bigger2==biggestno2)||(bigger2==biggestno)))
     {
         console.log('YES')
     }
     else{
         console.log('NO')
     }
     i++

 }
  //end-here
});

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readLine() {
    return inputString[currentLine++];
}
//###########################################################

function myFunc(arr){
    let maxD, minD, maxE, minE;
    maxE = Math.max(arr[0], arr[1]);
    maxD = Math.max(arr[2], arr[3]);

    minE = Math.min(arr[0], arr[1]);
    minD = Math.min(arr[2], arr[3]);
    if(maxE > minD && maxD > minE){
        return 'YES';
    }
    return 'NO';
}

//###########################################################
function main() {

    const t = parseInt(readLine(), 10);

    for(let i = 0; i < t; i++){

        // const line = readLine().split(' ');
        // const x = parseInt(line[0], 10);
        // const y = parseInt(line[1], 10);
        // const str = line[2].toString();

        const line = readLine().split(' ').map(p => +p);

        let result = myFunc(line);

        console.log(result);
    }

}

const readline = require("readline");
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false,
});

let c = 0;

rl.on("line", (d) => {
  if (c === 0) {
    c++;
    return;
  }

  const [a1, b1, c1, d1] = d.split(" ").map(Number);

  if (c1 > a1 && c1 > b1 && d1 > a1 && d1 > b1) {
    console.log("NO");
  } else if (c1 < a1 && c1 < b1 && d1 < a1 && d1 < b1) {
    console.log("NO");
  } else {
    console.log("YES");
  }

  c++;
});

rl.on("close", () => {});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0];
    for(var j = 1; j <= n; j++){
        var a = lines[j].split(' ');
        var win1 = Math.max(a[0],a[1]);
        var loss1 = Math.min(a[0],a[1]);
        var win2 = Math.max(a[2],a[3]);
        var loss2 = Math.min(a[2],a[3]);
        if (loss1 <= win2 && loss2 <= win1){
            console.log('YES');
        } else{
            console.log("NO");
        }
    }
});

let data = '';
process.stdin.on('data', c => data += c);

function* nextLine() {
	let lines = data.trim().split(/\n/g);
	for(let l of lines){
		yield l.trim();
	}
}

let nl = nextLine();

nl.elem = function(funParse) {
		return funParse(this.next().value);
	};

nl.array = function(funParse) {
		return this.next().value.split(/\s/g).map(funParse||(x => x));
	};

nl.num = function() {
		return nl.elem(Number);
	};

nl.nums = function() {
		return nl.array(Number);
	};

nl.line = function() {
		return this.next().value;
	};

const sol = () => {
	//your code this
	let t  = nl.num();
	let ans = [];
	for(let i = 0; i < t; i++){
		let a = nl.nums();
		let b = [a[0] > a[1]?a[0]:a[1], a[2] > a[3]?a[2]:a[3]];
		a.sort((x, y) => y - x);
		b.sort((x, y) => y - x);
		ans.push(a[0] === b[0] && a[1] === b[1]);

	}
	console.log(ans.map(e => e?'YES':'NO').join('\n'));
};

process.stdin.on('end', sol);

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

process.stdin.on('data' , data=>{
    input += data;
});
process.stdin.on('end' , ()=>{
    main(input);
});

function main(input) {
    input = input.split("\n");
    let z = 0;
    let testCases = +input[z++];

    while(testCases--){
        let [a, b, c, d] = input[z++].trim().split(' ').map(Number);
        let max1 = Math.max(a, b);
        let max2 = Math.max(c, d);

        if((max1 > c || max1 > d) && (max2 > a || max2 > b)){
            console.log("Yes");
        }
        else{
            console.log("NO");
        }
    }
}

var timer = 0;
function dfs(v, prev) {
   var h = {};
   v.__h = h;
   h.tin = ++timer;
   h.up = [];
   var i = 0;
   var next = prev;
   while (next) {
      h.up[i] = next;
      next = next.__h.up[i++];
   }
   var children = v.childNodes;
   for (i = 0; i < children.length; i++) {
      dfs(children[i], v);
   }
   h.tout = ++timer;
}

function solve() {
   var a = readArray((x, i) => [i, Number(x)]);
   a.sort((x, y) => y[1] - x[1]);
   var half = (a.length >> 1);
   write((a[0][0] < half ^ a[1][0] >= half) ? 'NO' : 'YES');
}

function init() {
   var T;
   T = 1;
   T = Number(read());
   for (var t = 0; t < T; t++) {
      solve();
   }
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

"use strict";
process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {

  var t=parseInt(readline());
while(t--)
{
    var a=readline().split(' ').map(a=>parseInt(a))
    var b=Math.max(a[0],a[1])
    var c=Math.min(a[2],a[3])
    var d=Math.min(a[0],a[1])
    var e=Math.max(a[2],a[3])
    if(b<c || d>e)console.log("NO")
    else console.log("YES");

}

}

const fin = (arr) => {
	if (arr.length === 2) {
		return arr;
	}

	const next = [];
	for (let i=0; i<arr.length/2; i++) {
		next[i] = Math.max(arr[i*2], arr[i*2+1]);
	}

	return fin(next);
}

const solve = (arr) => {
	const final = fin(arr).sort((a, b) => b-a);
	const sorted = arr.sort((a, b) => b-a).slice(0, 2);

	return final[0] === sorted[0] &&
		final[1] === sorted[1] ? 'YES' : 'NO';
}

let input = '';
process.stdin.on('data', str => input += str)
process.stdin.on('end', () => {
	const [t, ...lines] = input.trim().split('\n');

	for (let i=0; i<t; i++) {
		console.log(solve(lines[i].split(' ').map(v => +v)));
	}
})

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout,
});

const input = [];
let currLine = 0;

rl.on("line", (line) => {
    input.push(line);
});

rl.on("close", () => {
    main();
});

const read = () => {
    return input[currLine++];
};

const readArr = () => {
    return input[currLine++].split(" ").map(e=>parseInt(e));
};

const main = () => {

    const tc=parseInt(read());

    let i=0;
    while(i<tc){
        const arr=readArr();
        const sortedArr=[...arr].sort((a,b)=>{
            if(a<b){
                return -1;
            }
            return 1;
        });
        const first=sortedArr[3], second=sortedArr[2];
        let w1=0, w2=0;

        if(arr[0]>arr[1]){
            w1=arr[0];
        }
        else{
            w1=arr[1];
        }

        if(arr[2]>arr[3]){
            w2=arr[2];
        }
        else{
            w2=arr[3];
        }

        if((w1!=first && w1!=second) || (w2!=first && w2!=second)){
            console.log("NO");
        }
        else{
            console.log("YES");
        }

        i++;
    }

};

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
const mxll = (...args) => args.reduce((m, e) => e > m ? e : m);
const mill = (...args) => args.reduce((m, e) => e < m ? e : m);
const sqll = (v) => { if (v < 0n) throw 'negative input'; if (v < 2n) return v; const dfs = (n, x0) => { let x1 = ((n / x0) + x0) >> 1n; if (x0 === x1 || x0 === (x1 - 1n)) return x0; return dfs(n, x1); }; return dfs(v, 1n); }; // has >> 0
const abs = Math.abs;
const fl = Math.floor;
const ce = Math.ceil;
const sq = Math.sqrt;
const lge = Math.log;
const lg10 = Math.log10;
const ll = BigInt;
const combination = (m, n) => { return factorial(m, n) / factorial(n, n); };
const factorial = (m, n) => { let num = 1n; let cnt = 0; for (let i = ll(m); i > 0; i--) { if (cnt == n) break; num *= i; cnt++; } return num; };
const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
const bitCount = (n) => { n = n - ((n >> 1) & 0x55555555); n = (n & 0x33333333) + ((n >> 2) & 0x33333333); return ((n + (n >> 4) & 0xF0F0F0F) * 0x1010101) >> 24; };
const powmod = (a, b, mod) => { let r = 1n; while (b > 0n) { if (b % 2n == 1) r = r * a % mod; b >>= 1n; a = a * a % mod; } return r; };
const amax = (a) => mx.apply(Math, a);
const amin = (a) => mi.apply(Math, a);
const sm = (a) => a.reduce(((x, y) => x + y), 0);
const aeq = (a, b) => JSON.stringify(a) == JSON.stringify(b);
const swap = (a, i, j) => [a[i], a[j]] = [a[j], a[i]];
const stin = (a) => a.sort((x, y) => x - y);
const stde = (a) => a.sort((x, y) => y - x);
const sortPart = (a, k) => { let l = a.slice(0, k); l.sort((x, y) => x - y); let r = a.slice(k); return l.concat(r); }; // sort first kth
const initialize2DArrayNew = (m, n) => { let data = []; for (let i = 0; i < m; i++) { let tmp = Array(n).fill(0); data.push(tmp); } return data; };
const stmkey_in = (m) => new Map([...m].sort((x, y) => x[0] - y[0]));
const stmkey_de = (m) => new Map([...m].sort((x, y) => y[0] - x[0]));
const stmvalue_in = (m) => new Map([...m].sort((x, y) => x[1] - y[1]));
const stmvalue_de = (m) => new Map([...m].sort((x, y) => y[1] - x[1]));
const counter = (a_or_s) => { let map = new Map(); for (const i of a_or_s) map.set(i, map.get(i) + 1 || 1); return map; };
const counter_value_in_indexA_in = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).push(i); } return m; };
const counter_value_in_indexA_de = (a_or_s) => { let m = new Map(); let n = a_or_s.length; for (let i = 0; i < n; i++) { if (!m.has(a_or_s[i])) m.set(a_or_s[i], []); m.get(a_or_s[i]).unshift(i); } return m; };
const reverse2 = (s) => { let res = ""; for (let i = s.length - 1; i >= 0; i--) { res += s[i]; } return res; };
const isPalindrome = (s) => { let n = s.length; let i = 0; let j = n - 1; while (i < j) { if (s[i++] != s[j--]) return false; } return true; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

const solve = (a, b, c, d) => {
    let A = [a, b, c, d];
    stde(A);
    let should = [A[0], A[1]];
    let actual = [mx(a, b), mx(c, d)];
    stin(should);
    stin(actual);
    // pr(should, actual);
    let res = should[0] == actual[0] && should[1] == actual[1];
    pr(res ? 'YES' : 'NO');
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1], input[i][2], input[i][3]);
            i++;
        }
    });
};

main()

process.stdin.setEncoding('utf-8')
const readline = require('readline')

const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    }
)

let count = -1
let inputArr = []

rl.on('line', data => {
    if (count === -1) {
        count = +data
    } else if (count !== 0) {
        inputArr.push(data.trim())
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        inputArr = inputArr.map(i => i.split(' ').map(j => +j))
        main()
        process.exit(0)
    }
})

function solve(arr) {
    const [max1,max2] = arr.slice(0).sort((a,b)=>a-b).reverse()
    if((max1 === arr[0] || max1 === arr[1]) && (max2 === arr[2] || max2 === arr[3])){
        console.log('YES')
    } else if((max1 === arr[2] || max1 === arr[3]) && (max2 === arr[0] || max2 === arr[1])){
        console.log('YES')
    } else {
        console.log('NO')
    }
}

function main() {
    for (let i = 0; i < inputArr.length; i++) solve(inputArr[i])
}

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var t = parseInt(lines[0]);
    var l = 1;
    for (var i = 0; i < t; i++) {
        console.log(solve(lines[l++]));
    }
});

function solve(str) {
    const skills = str.split(' ').map(Number)
    const [a, b, c, d] = skills
    const p = Math.max(a, b)
    const q = Math.max(c, d)

    skills.sort((a, b) => b - a)

    const [m, n] = skills
    let fair
    if (p > q) {
        fair = p === m && q === n
    } else {
        fair = q === m && p === n
    }
    return fair ? 'YES' : 'NO'
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = BigInt(next());
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var s = nextIntArray(4);
		var tmp = makeClone(s);
		var L = Math.max(s[0], s[1]);
		var R = Math.max(s[2], s[3]);
		tmp.sort(function(a,b){
			return b - a;
		});
		if((tmp[0] == L || tmp[0] == R) && (tmp[1] == L || tmp[1] == R)){
			myout("YES");
		}else{
			myout("NO");
		}
	}
}

var testCase=+readline()
for(var i=0;i<testCase;i++){
    var sequence=readline().split(" ").map(node=>+node),counter=0

    var aMax=sequence.slice(0,2).reduce((a,b)=>Math.max(a,b))
    var b=sequence.slice(-2)

    b.forEach(node=>node>aMax?counter++:null)

    counter===0||counter===2?print("NO"):print("YES")
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split
        console.log(array)
        // let a = array[0]>array[1]?array[0]:array[1];
        // let b = array[2]>array[3]?array[2]:array[3];
        // a < b ?
        // a > array[2] || a > array[3] ? console.log('YES'): console.log('NO'):
        // b > array[0] || b > array[1] ? console.log('YES'): console.log('NO');
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split(' ');
        let a = array[0]>array[1]?array[0]:array[1];
        let b = array[2]>array[3]?array[2]:array[3];
        a < b ?
        a > array[2] || a > array[3] ? console.log('YES'): console.log('NO'):
        b > array[0] || b > array[1] ? console.log('YES'): console.log('NO');
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split(' ');
        let a = array[0]>array[1]?array[0]:array[1];
        let b = array[2]>array[3]?array[2]:array[3];
        a < b ?
        a > array[2] || a > array[3] ? console.log('YES'): console.log('NO'):
        b > array[0] || b > array[1] ? console.log('YES'): console.log('NO')
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split(' ');
        let a = array[0]>array[1]?array[0]:array[1];
        let b = array[2]>array[3]?array[2]:array[3];
        a < b ?
        a < array[2] && a < array[3] ? console.log('NO'): console.log('YES'):
        b < array[0] && b < array[1] ? console.log('NO'): console.log('YES')
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split(' ');
        let a = array[0]>array[1]?array[0]:array[1];
        let b = array[2]>array[3]?array[2]:array[3];
        a < b ?
        a < array[2] && a < array[3] ? console.log('YES'): console.log('NO'):
        b < array[0] && b < array[1] ? console.log('YES'): console.log('NO')
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
    const x = readline();

    for(let i = 0;i < x;i++){
        let array = readline().split(' ');
        let a = array[0]>array[1]?array[0]:array[1];
        let b = array[2]>array[3]?array[2]:array[3];
        a < b ?
        a < array[2] || a < array[3] ? console.log('NO'):console.log('YES'):
        b < array[0] || array[1]?console.log('NO'):console.log('YES')
    }
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let input = '';
process.stdin.on('data', inputStdin => {
    input += inputStdin;
});
process.stdin.on('end', _ => {
    main(input);
});

function main(input) {
    var args = input.split("\n");
    const t = parseInt(args[0], 10);
    for (var i = 1; i <= t; i++) {
        var v = args[i].split(" ").map((n) => parseInt(n, 10));
        var v2 = v.concat();
        v2.sort();
        if (((v2[0] == v[0] && v2[1] == v[1])
            || (v2[0] == v[1] && v2[1] == v[0])
            || (v2[0] == v[2] && v2[1] == v[3])
            || (v2[0] == v[3] && v2[1] == v[2]))) {
            console.log("NO");
        } else {
            console.log("YES");
        }
    }
}

'use strict';
process.stdin.resume();
process.stdin.setEncoding('utf-8');
let input = '';
process.stdin.on('data', inputStdin => {
    input += inputStdin;
});
process.stdin.on('end', _ => {
    main(input);
});

function main(input) {
    var args = input.split("\n");
    const t = parseInt(args[0], 10);
    for (var i = 1; i <= t; i++) {
        var v = args[i].split(" ").map((n) => parseInt(n, 10));
        var v2 = v.concat();
        v2.sort();
        if (((v[0] == v2[0] && v[1] == v2[1])
            || (v[0] == v2[1] && v[1] == v2[0])
            || (v[0] == v2[2] && v[1] == v2[3])
            || (v[0] == v2[3] && v[1] == v2[2]))) {
            console.log("NO");
        } else {
            console.log("YES");
        }
    }
}

const os = require('os');

function winner(players_skills) {
    return Math.max(players_skills[0], players_skills[1])
}

function solution(input) {
    const champion = Math.max(winner(input.slice(0, 2)), winner(input.slice(2, 4)));
    const runner_up = Math.min(winner(input.slice(0, 2)), winner(input.slice(2, 4)));
    console.log({champion, runner_up});
    input.sort((a, b) => b - a);

    return input[0] === champion && input[1] === runner_up ? 'YES' : 'NO';
}

function parse(input_in_string) {
    return input_in_string.split(' ').map(Number);
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(os.EOL);
    const number_of_test_cases = Number(input.shift());
    for(let test_case = 1; test_case <= number_of_test_cases; test_case += 1) {
        console.log(solution(parse(input.shift())));
    }
});

module.exports = {solution}

const os = require('os');

function winner(players_skills) {
    return Math.max(players_skills[0], players_skills[1])
}

function solution(input) {
    const champion = Math.max(winner(input.slice(0, 2)), winner(input.slice(2, 4)));
    const runner_up = Math.min(winner(input.slice(0, 2)), winner(input.slice(0, 2)));
    input.sort((a, b) => b - a);

    return input[0] === champion && input[1] === runner_up ? 'YES' : 'NO';
}

function parse(input_in_string) {
    return input_in_string.split(' ').map(Number);
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(os.EOL);
    const number_of_test_cases = Number(input.shift());
    for(let test_case = 1; test_case <= number_of_test_cases; test_case += 1) {
        console.log(solution(parse(input.shift())));
    }
});

module.exports = {solution}

const os = require('os');

function winner(players_skills) {
    return Math.max(players_skills[0], players_skills[1])
}

function solution(input) {
    const champion = Math.max(winner(input.slice(0, 2)), winner(input.slice(2, 4)));
    const runner_up = Math.min(winner(input.slice(0, 2)), winner(input.slice(0, 2)));
    input.sort((a, b) => b - a);

    return input[0] === champion && input[1] === runner_up ? 'YES' : 'NO';
}

function parse(input_in_string) {
    return input_in_string.split(' ').map(Number);
}

let lines = '';

process.stdin.on('data', data => lines += data);

process.stdin.on('end', () => {
    const input = lines.split(os.EOL);
    input.shift();
    while (input.length !== 0) {
        console.log(solution(parse(input.shift())));
    }
});

module.exports = {solution}

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL); /*your input text, split by lines*/
    for(j = 1; j <= lines[0]; j++){
        var a = lines[j].split(' ')
        var x = Math.min(a[0], a[1])
        var c = Math.max(a[2], a[3])
        var v = Math.max(a[0], a[1])
        var z = Math.min(a[2], a[3])
        if(x <= c && v <= z){
            console.log('YES')
        }else {
            console.log('NO')
        }
    }
    });
//2 - 2 % 0 + 1
//2 - 2 % 0 - (0 - 1)
//xcvz
//2, min, *
//[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]; '15'

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {

const testcase=parseInt(readline());
let r=[];
for(let i=0;i<testcase;i++){
for(let i=0;i<4;i++){

  r[i]=+(readline());

}
let x=Math.max(r[0],r[1]);
let t=Math.min(r[0],r[1]);
let z=Math.min(r[2],r[3]);
    let y=Math.max(r[2],r[3]);

    if(x>z && y>t) console.log('YES');

    else console.log("NO");

}

}

"use strict";

process.stdin.resume();
process.stdin.setEncoding("utf-8");

function print(x) {
  console.log(x);
}
let inputString = "";
let currentLine = 0;

process.stdin.on("data", (inputStdin) => {
  inputString += inputStdin;
});
process.stdin.on("end", () => {
  inputString = inputString.split("\n");
  main();
});
function readline() {
  return inputString[currentLine++];
}

// ********** Code Start **********

function main() {

const testcase=parseInt(readline());
let r=[];
for(let i=0;i<testcase;i++){
for(let i=0;i<4;i++){

  r[i]=+(readline());

}
}

    let x=Math.max(r[0],r[1]);
let t=Math.min(r[0],r[1]);
let z=Math.min(r[2],r[3]);
    let y=Math.max(r[2],r[3]);

    if(x>z && y>t) console.log('YES');

    else console.log("NO");

}

// Getting input via STDIN
const readline = require("readline");

const inp = readline.createInterface({
  input: process.stdin
});

const userInput = [];

inp.on("line", (data) => {
  userInput.push(data);
});

inp.on("close", () => {
  //start-here
  //Your code goes here … replace the below line with your code logic
var i=1;
 var t=userInput[0]
 while(i<=t)
 {
     dummy=userInput[i].split(' ')
     arr=dummy

     var bigger=Math.max(dummy[0],dummy[1])

     if(dummy[2]<dummy[3]){
         var bigger2=dummy[3]
     }
     else if(dummy[2]>dummy[3]){
         bigger2=dummy[2]
     }

    var sortedarr=arr.sort()
     var biggestno=sortedarr[3]
     var biggestno2=sortedarr[2]
     if(((bigger==biggestno)||(bigger==biggestno2))&&((bigger2==biggestno2)||(bigger2==biggestno)))
     {
         console.log('YES')
     }
     else{
         console.log('NO')
     }
     i++

 }
  //end-here
});


Ivan recently bought a detective book. The book is so interesting that each page of this book introduces some sort of a mystery, which will be explained later. The $$$i$$$-th page contains some mystery that will be explained on page $$$a_i$$$ ($$$a_i \ge i$$$).Ivan wants to read the whole book. Each day, he reads the first page he didn't read earlier, and continues to read the following pages one by one, until all the mysteries he read about are explained and clear to him (Ivan stops if there does not exist any page $$$i$$$ such that Ivan already has read it, but hasn't read page $$$a_i$$$). After that, he closes the book and continues to read it on the following day from the next page.How many days will it take to read the whole book?

The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^4$$$) — the number of pages in the book. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$i \le a_i \le n$$$), where $$$a_i$$$ is the number of page which contains the explanation of the mystery on page $$$i$$$.

Print one integer — the number of days it will take to read the whole book.

NoteExplanation of the example test:During the first day Ivan will read only the first page. During the second day Ivan will read pages number $$$2$$$ and $$$3$$$. During the third day — pages $$$4$$$-$$$8$$$. During the fourth (and the last) day Ivan will read remaining page number $$$9$$$.

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', function() {
    inputString = inputString
        .replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    console.log(getDays(inputString[1].split(' ').map(i => parseInt(i, 10))));
});

function getDays(arr) {
    let stack = [];
    let count = 0;
    for (let i = 0; i < arr.length; i++) {
        stack.push(arr[i]);

        while(stack[stack.length - 1] <= i + 1) {
            stack.pop();
        }

        if (stack.length === 0) {
            count++;
        }
    }

    return count;
}

const readline = require('readline');

const rl = readline.createInterface({
	input: process.stdin,
	setEncoding: 'utf8',
	terminal: false
});

const readInput = (function* () {
	const n = Number(yield);
	const a = (yield).trim().split(' ').map(Number);
	rl.close();
	let to = 0;
	let days = 0;
	for (let i = 0; i < n; i++) {
		to = Math.max(to, a[i]);
		if (to == a[i] && to == i + 1) days++;
	}
	console.log(days);
})();

readInput.next();

rl.on('line', (line) => {
	readInput.next(line);
});

const n = Number(readline());
const pages = readline().split(" ").slice(0, n).map(x => Number(x));
var max = 0;
var count = 0;
for (var i = 0; i < n; i++) {
  var next = pages[i];
  if (next > max) max = next;
  if (max <= i + 1) count++;
}
print(count);

var n = readline();
var a = readline().split(' ');
a=a.slice(0,n);

var days=0;
var max=Number.MIN_VALUE;
var changed=false;
for(var i=0; i<n; i++){
    if(Number(a[i])>max) {
        max=Number(a[i]);
        changed=true;
    }
    if(Number(a[i])==max && max==(i+1) && changed){
        days++;
        changed=false;
    }
}
print(days);

var n = readline();
var a = readline().split(' ');
a=a.slice(0,n);

var days=0;
var max=Number.MIN_VALUE;
var changed=false;
for(var i=0; i<n; i++){
    if(Number(a[i])>max) {
        max=Number(a[i]);
        changed=true;
    }
    if(max==(i+1) && changed){
        days++;
        changed=false;
    }
}
print(days);

var len = parseInt(readline());
var pagesArr = readline().split(' ').map(_=>{return parseInt(_)});

var curLastPage = 0;
var readTimes = 0;
for (var index = 0; index < len;index ++) {
    if (pagesArr[index] > curLastPage) {
        curLastPage = pagesArr[index];
    }
    if (curLastPage == index + 1) {
        readTimes ++;
    }
}
print(readTimes);

const n = Number(readline());
const pages = readline().split(" ").slice(0, n).map(x => Number(x));
var max = 0;
var count = 0;
for (var i = 1; i <= n; i++) {
  next = pages[i];
  if (next > max) max = next;
  if (max <= i) count++;
}
print(count);

var n = readline();
var a = readline().split(' ');
a=a.slice(0,n);

var days=0;
var max=Number.MIN_VALUE;
for(var i=0; i<n; i++){
    if(a[i]>max) max=a[i];
    if(max>(i+1)){
        continue;
    }
    days++;
}
print(days);

var n = readline();
var a = readline().split(' ');
a=a.slice(0,n);

var days=0;
var max=Number.MIN_VALUE;
for(var i=0; i<n; i++){
    if(a[i]>max) max=a[i];
    if(Number(a[i])>(i+1) || max>(i+1)){
        continue;
    }
    days++;
}
print(days);

var n = readline();
var a = readline().split(' ');
a=a.slice(0,n);

var days=0;
var max=Number.MIN_VALUE;
var changed=false;
for(var i=0; i<n; i++){
    if(Number(a[i])>max) {
        max=Number(a[i]);
        changed=true;
    }
    if(Number(a[i])==max && max==(i+1) && changed){
        print(a[i]+" "+max)
        days++;
        changed=false;
    }
}
print(days);

var n = readline();
var a = readline().split(' ');
a=a.slice(0,n);

var days=0;
var max=Number.MIN_VALUE;
for(var i=0; i<n; i++){
    if(Number(a[i])>max) {
        max=Number(a[i]);
        var changed=true;
    }
    if(Number(a[i])==max && changed){
        days++;
        changed=false;
    }
}
print(days);


Alice and Bob play ping-pong with simplified rules.During the game, the player serving the ball commences a play. The server strikes the ball then the receiver makes a return by hitting the ball back. Thereafter, the server and receiver must alternately make a return until one of them doesn't make a return.The one who doesn't make a return loses this play. The winner of the play commences the next play. Alice starts the first play.Alice has $$$x$$$ stamina and Bob has $$$y$$$. To hit the ball (while serving or returning) each player spends $$$1$$$ stamina, so if they don't have any stamina, they can't return the ball (and lose the play) or can't serve the ball (in this case, the other player serves the ball instead). If both players run out of stamina, the game is over.Sometimes, it's strategically optimal not to return the ball, lose the current play, but save the stamina. On the contrary, when the server commences a play, they have to hit the ball, if they have some stamina left.Both Alice and Bob play optimally and want to, firstly, maximize their number of wins and, secondly, minimize the number of wins of their opponent.Calculate the resulting number of Alice's and Bob's wins.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The first and only line of each test case contains two integers $$$x$$$ and $$$y$$$ ($$$1 \le x, y \le 10^6$$$) — Alice's and Bob's initial stamina.

For each test case, print two integers — the resulting number of Alice's and Bob's wins, if both of them play optimally.

NoteIn the first test case, Alice serves the ball and spends $$$1$$$ stamina. Then Bob returns the ball and also spends $$$1$$$ stamina. Alice can't return the ball since she has no stamina left and loses the play. Both of them ran out of stamina, so the game is over with $$$0$$$ Alice's wins and $$$1$$$ Bob's wins.In the second test case, Alice serves the ball and spends $$$1$$$ stamina. Bob decides not to return the ball — he loses the play but saves stamina. Alice, as the winner of the last play, serves the ball in the next play and spends $$$1$$$ more stamina. This time, Bob returns the ball and spends $$$1$$$ stamina. Alice doesn't have any stamina left, so she can't return the ball and loses the play. Both of them ran out of stamina, so the game is over with $$$1$$$ Alice's and $$$1$$$ Bob's win.In the third test case, Alice serves the ball and spends $$$1$$$ stamina. Bob returns the ball and spends $$$1$$$ stamina. Alice ran out of stamina, so she can't return the ball and loses the play. Bob, as a winner, serves the ball in the next $$$6$$$ plays. Each time Alice can't return the ball and loses each play. The game is over with $$$0$$$ Alice's and $$$7$$$ Bob's wins.

const solve = (x, y) => {
    console.log(x - 1 + " " + y);
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t > 0) {
            solve(input[i][0], input[i][1]);
            t--;
            i++;
        }
    });
};

main()

let inputString = "";
let currentLine = 0;
process.stdin.on("data", (data) => {
  inputString += data;
});
process.stdin.on("end", function () {
  inputString = inputString
    .trim()
    .split("\n")
    .map((str) => str.trim());
  main();
});
function readLine() {
  return inputString[currentLine++];
}

// utils
const MOD = 1e9 + 7;
const mod = (n) => ((n % MOD) + MOD) % MOD;
const add = (a, b) => mod(mod(a) + mod(b));
const sub = (a, b) => mod(mod(a) - mod(b));
function mul() {
  for (var a = arguments, r = a[0], i = a.length; --i; )
    r = ((((r >> 16) * a[i]) % MOD) * 65536 + (r & 65535) * a[i]) % MOD;
  return r;
}
function inv(b) {
  for (var a = MOD, u = 0, v = 1, t; b; v = t)
    (t = (a / b) | 0), (a -= t * b), (u -= t * v), (t = a), (a = b), (b = t), (t = u), (u = v);
  u %= MOD;
  return u < 0 ? u + MOD : u;
}
function pow(base, n) {
  if (n === 0) return 1;
  let p = pow(base, Math.floor(n / 2));
  let res = mul(mod(p), mod(p));
  if (n % 2 === 1) res = mul(mod(res), base);
  return res;
}
function highestOneBit(i) {
  i |= i >> 1;
  i |= i >> 2;
  i |= i >> 4;
  i |= i >> 8;
  i |= i >> 16;
  return i - (i >>> 1);
}
function permutation(arr, len, store = "", permutations = []) {
  if (store.length === len) {
    permutations.push(store);
    return;
  }
  for (let i = 0; i < arr.length; i++) {
    const newArr = [...arr];
    const newChar = newArr.splice(i, 1);
    permutation(newArr, len, store.concat(newChar), permutations);
  }
  return permutations;
}

function main() {
  let t = +readLine();
  while (t--) {
    const [a, b] = readLine().split(" ").map(Number);
    if (a === b) {
      console.log(`${a - 1} ${b}`);
    } else if (a > b) {
      console.log(`${a - 1} ${b}`);
    } else {
      console.log(`${a - 1} ${b}`);
    }
  }
}

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var x = nextInt() - 1;
		var y = nextInt();
		myout(x + " " + y);
	}
}

(()=>{"use strict";var t={675:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),Array.numbersMatrix=(t,e,r)=>{let n=[];null==t&&(e=t),null==r&&(r=0);for(let i=0;i<t;++i){let t=[];for(let n=0;n<e;++n)t.push(r);n.push(t)}return n},Array.prototype.sortAsc=function(){return this.sort(((t,e)=>t-e))},Array.prototype.sortDesc=function(){return this.sort(((t,e)=>e-t))},Array.prototype.max=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.max(t,this[e]);return t},Array.prototype.min=function(){if(0==this.length)return 0;let t=this[0];for(let e=1;e<this.length;++e)t=Math.min(t,this[e]);return t},Array.prototype.sum=function(){let t=0;for(let e=0;e<this.length;++e)t+=this[e];return t},Array.prototype.modSum=function(t){let e=0;for(let r=0;r<this.length;++r)e+=this[r],e%=t;return e},Array.prototype.avg=function(){return this.sum()/this.length},Array.prototype.groupBy=function(t){let e=new Map;for(let r=0;r<this.length;++r){const n=t(this[r]);e.has(n)?e.get(n).push(this[r]):e.set(n,[this[r]])}return e},Array.prototype.deepCopy=function(){let t=[];if(0==this.length)return t;let e=!1;Array.isArray(this[0])&&(e=!0);for(let r=0;r<this.length;++r)e?t.push(this[r].deepCopy()):t.push(this[r]);return t},Array.prototype.transpose=function(){let t=[];if(0==this.length)return[[]];for(let e=0;e<this[0].length;++e){let r=[];for(let t=0;t<this.length;++t)r.push(this[t][e]);t.push(r)}return t},Array.prototype.toString=function(){if(0==this.length)return"";if(!Array.isArray(this[0]))return this.join(" ");let t="";for(let e=0;e<this.length;++e)t+=this[e].join(" "),e!=this.length-1&&(t+="\n");return t}},312:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const i=n(r(747));let o="",s=[],u=0,l="";const p="local"===process.argv[2],h=t=>{if(p){if(s=i.default.readFileSync("input.txt").toString().trim().split("\n").map((t=>t.trim())),t(),i.default.writeFileSync("output.txt",l),console.log(l),i.default.readFileSync("expected.txt").toString().trim()==l.trim()){const{exec:t}=r(129);t("osascript -e 'display notification \"✅ AC!!\"'")}}else process.stdin.resume(),process.stdin.setEncoding("utf-8"),process.stdin.on("data",(t=>{o+=t})),process.stdin.on("end",(e=>{s=o.trim().split("\n").map((t=>t.trim())),t(),console.log(l)}))};function a(){return s[u++]}function f(){return a().split(" ").map((t=>parseFloat(t)))}function c(){return a().split("")}e.default={runMain:h,runEachTest:t=>{h((()=>{let[e]=f();for(;e>0;)t(),e--}))},readline:a,nextNumbers:f,nextBigNumbers:function(){return a().split(" ").map((t=>BigInt(t)))},nextNumbersMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(f());return e},nextCharacters:c,nextCharacterMatrix:function(t){let e=[];for(let r=0;r<t;++r)e.push(c());return e},nextIntervalArray:function(t){let e=[];for(let r=0;r<t;++r){const[t,r]=f();e.push({a:t,b:r})}return e},put:function(t){l+=t},puts:function(t){l+=t+"\n"},debug:function(t){p&&console.log(t)}}},965:function(t,e,r){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),r(675);const i=n(r(312));i.default.runEachTest((function(){let[t,e]=i.default.nextNumbers();t--,i.default.puts(t+" "+e)}))},129:t=>{t.exports=require("child_process")},747:t=>{t.exports=require("fs")}},e={};!function r(n){if(e[n])return e[n].exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}(965)})();

// Solution written in typescript and compiled via webpack. Original source code below
// Happy Hacking 😜

// import './array'
//
// import io from './io'
//
// function main() {
//   let cnt = (x: number, y: number, p1: boolean, running: boolean) => {
//     // io.debug([x, y, p1, running])
//
//     if (y == 0) {
//       return [x, 0]
//     }
//
//     if (x == 0) {
//       return [0, y]
//     }
//
//     if (!running) {
//       if (p1) {
//         return cnt(x - 1, y, !p1, true)
//       } else {
//         return cnt(x, y - 1, !p1, true)
//       }
//     }
//
//     let candidate1 = [0, 0]
//
//     if (p1) {
//       candidate1 = cnt(x - 1, y, !p1, true)
//     } else {
//       candidate1 = cnt(x, y - 1, !p1, true)
//     }
//
//     let candidate2 = [0, 0]
//
//     if (p1) {
//       candidate2 = cnt(x, y, !p1, false)
//       candidate2[1]++
//     } else {
//       candidate2 = cnt(x, y, !p1, false)
//       candidate2[0]++
//     }
//
//     // io.debug(candidate1)
//     // io.debug(candidate2)
//
//     if (p1) {
//       if (candidate1[0] == candidate2[0]) {
//         return [candidate1[0], [candidate1[1], candidate2[1]].max()]
//       }
//
//       if (candidate1[0] > candidate2[0]) {
//         return candidate1
//       } else {
//         return candidate2
//       }
//     } else {
//       if (candidate1[1] == candidate2[1]) {
//         return [[candidate1[0], candidate2[0]].max(), candidate1[1]]
//       }
//
//       if (candidate1[1] > candidate2[1]) {
//         return candidate1
//       } else {
//         return candidate2
//       }
//     }
//   }
//
//   let [x, y] = io.nextNumbers()
//
//   // let n = 10
//
//   // for (let x = 1; x <= n; ++x) {
//   //   for (let y = 1; y <= n; ++y) {
//   //     io.puts(x + " " + y + " :" + cnt(x, y, true, false))
//   //   }
//   // }
//
//   x--
//
//   io.puts(x + " " + y)
// }
//
// io.runEachTest(main)
// // io.runMain(main)

/*
 * File Created: Monday, 30th November 2020 3:31:00 pm
 * Author: Lukas Rimkus
 */

'use-strict'

process.stdin.resume();
process.stdin.setEncoding('utf8');

let data = '';
let currentLine = 0;

process.stdin.on('data', chunk => {
data += chunk;
});

process.stdin.on('end', () =>{
    data = data.replace(/\s*$/, '')
    .split('\n')
    .map(str => str.replace(/\s*$/, ''));

    let testCases = parseInt(data.shift());

    while(testCases--) {

        const n = data.shift().split(' ').map(Number)

        const res = c(n[0], n[1]);

        console.log(res[0], res[1])
    }
});

function get_ints() {
    return data.shift().split(' ').map(Number);
}

function readLine() {
        return data[currentLine++];
}

function a(num)
{
    return num.length ;
}

function b(goal)
{

    function jump1(y,k)
    {
        return y + k;
    }
    function jump2(y)
    {
        return y - 1;
    }

    let sum = 0;

    let jumps = 0;

    let arr = [];

    while(sum < goal)
    {
        jumps++;

        arr.push(jumps);

        sum = sum + jumps;
    }

    if(sum === goal)
    {
        return arr.length;
    }
    else
    {
        let current_pos = sum;

        // that's how many steps back;
        let diference = current_pos - goal;

        console.log(arr, arr.length, sum, diference)

        for(let i = 0 ; i < arr.length; i++)
        {
            if((arr[i] + 1) === diference)
            {
                return arr.length;
            }
        }
       return arr.length + 1;
    }
}

function c(x,y)
{
    const arr = new Array(2);

    arr[0] = x - 1;

    arr[1] = y
    return arr;
}

module.exports = c;

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const x = readline();
  var answer = []

  Array(Number(x)).fill(1).map((t, i) => {
    var line = readline();
    var x = Number(line.split(' ')[0])
    var y = Number(line.split(' ')[1])
    return console.log(x - 1, y)
    if (x == 0 && y === 0) return console.log(0, 0)
    if (y > x) {
      return console.log(0, y - x + 1)
    }
    if (x === y) return console.log(0, 1)
    return console.log(x - 1, y)

  })

}

var tc = parseInt(readline());
for (; tc--;){
    var Ar = readline().split(' ').map(x => +x);
    var n = Ar[0], m = Ar[1];
    print(n - 1 + ' ' + m);
}

const solve = (x, y) => {
    if (x >= y) {
        console.log(x - 1 + " " + y);
        return;
    } else {
        console.log(x - 1 + " " + (y - x + 1));
        return;
    }
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t > 0) {
            solve(input[i][0], input[i][1]);
            t--;
            i++;
        }
    });
};

main()

const solve = (x, y) => {
    if (x >= y) {
        console.log(x - 1 + " " + y);
    } else {
        console.log(x - 1 + " " + (y - x + 1));
    }
};

const main = () => {
    const readline = require('readline');
    const rl = readline.createInterface({
        input: process.stdin,
        output: process.stdout
    });
    let input = [];
    rl.on('line', (line) => {
        input.push(line.split(" ").map(x => Number(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t > 0) {
            solve(input[i][0], input[i][1]);
            t--;
            i++;
        }
    });
};

main()

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const x = readline();
  var answer = []

  Array(Number(x)).fill(1).map((t, i) => {
    var line = readline();
    var x = line.split(' ')[0]
    var y = line.split(' ')[1]
    if (y > x) {
      if (x === 0) return console.log(0, y)
      return console.log(0, y - x + 1)
    }
    if (x === y) return console.log(0, 1)
    if (y === 0) return console.log(x, 0)
    return console.log(x - y, 1)

  })

}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const x = readline();
  var answer = []

  Array(Number(x)).fill(1).map((t, i) => {
    var line = readline();
    var x = Number(line.split(' ')[0])
    var y = Number(line.split(' ')[1])
    if(x==0 && y===0) return console.log(0, 0)
    if (y > x) {
      return console.log(0, y - x + 1)
    }
    if (x === y) return console.log(0, 1)
    return console.log(x-1, y)

  })

}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
  inputString += inputStdin;
});

process.stdin.on('end', _ => {
  inputString = inputString.trim().split('\n').map(string => {
    return string.trim();
  });

  main();
});

function readline() {
  return inputString[currentLine++];
}

// Make a Snippet for the code above this and then write your logic in main();

function main() {
  const x = readline();
  var answer = []

  Array(Number(x)).fill(1).map((t, i) => {
    var line = readline();
    var x = Number(line.split(' ')[0])
    var y = Number(line.split(' ')[1])
    if(x==0 && y===0) return console.log(0, 0)
    if (y > x) {
      if (x === 0) return console.log(0, y)
      return console.log(0, y - x + 1)
    }
    if (x === y) return console.log(0, 1)
    if (y === 0) return console.log(x, 0)
    return console.log(x - y, 1)

  })

}