"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const gcd = (a, b) => (a % b === 0 ? b : gcd(b, a % b));
  let t = parseInt(readline());
  while (t--) {
       let [n,k] = readline().trim().split(" ").map(cur=>parseInt(cur));
       if(k===1) console.log("NO");
       else{
            console.log("YES");
            if(k===2) console.log(`${3*n} ${5*n} ${8*n}`);
            else console.log(`${n*(k-1)} ${n*(k+1)} ${n*k*2}`);
       }
  }
};
solve();

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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; };
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 05/09/21 evening
const solve = (a, b) => {
    if (b == 1) {
        return pr('NO');
    }
    pr('YES');
    pr(a, a * (2 * b - 1), 2 * a * b);
};

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]);
            i++;
        }
    });
};

main()

var tt;
tt=parseInt(readline());

while(tt--){
    var a,b,arr;
    arr=readline().split(' ');
    a=parseInt(arr[0]);
    b=parseInt(arr[1]);

    if(b==1){print("NO");}
    else{
         print("YES");
         var z=(a*b);
         var x=a;
         var y=z+a;

         print(x,z,y);
    }
}

var e=readline();
for(var i=0;i<e;i++){
  var s=readline().split(' ');
  var a=parseInt(s[0]);
  var b=parseInt(s[1]);
  if(b==1){
   print("NO");
  }
  else{
  print("YES");
  var p= 2*a*b-a;
  print(a+' '+p+' '+(p+a));
  }
}

#!/usr/bin/env node
'use strict';

const { createInterface } = require('readline');
const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
});

const buf = [];
const prom = [];
let maxBuf = 0;
let maxProm = 0;
rl.on('line', (line) => {
  if (prom.length > 0) {
    maxProm = Math.max(maxProm, prom.length);
    const [resolve, reject] = prom.shift();
    resolve(line);
  } else {
    rl.pause();
    buf.push(line);
    maxBuf = Math.max(maxBuf, buf.length);
  }
});

rl.on('close', () => {
  // console.error({maxProm, maxBuf});
});

async function getLine() {
  return new Promise((resolve, reject) => {
    if (buf.length > 0) {
      const line = buf.shift();
      resolve(line);
    } else {
      prom.push([resolve, reject]);
      rl.resume();
    }
  });
}

/**
 *
 * @param {Number} a
 * @param {Number} b
 * @returns {Number []}
 */
function solve(a, b) {
  if (b <= 1 || a < 1) {
    return [];
  }
  if (b === 2) {
    return [a, 3 * a, 4 * a];
  }
  return [a, (b-1) * a, a * b];
}

async function main() {
  const t = Number(await getLine());
  for (let i = 0; i < t; i++) {
    const [a, b] = (await getLine()).split(' ').map(Number);
    const res = solve(a, b);
    if (res.length === 3) {
      console.log('YES');
      console.log(res.join(' '));
    } else {
      console.log('NO');
    }
  }
}

if (require.main === module) {
  main();
}

const solve = (a, b) => {
    if (b === 1) {
        console.log('NO');
    } else {
        console.log('YES');
        console.log(a, a * b, a * (b + 1));
    }
};

let line = '';
process.stdin.on('data', c => line += c);
process.stdin.on('end', () => {
    const input = line.trim().split('\n');
    for (let i = 1; i < input.length; i++) {
        const [a, b] = input[i].split(' ').map(item => parseInt(item));
        solve(a, b);
    }
});

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([a, b]) {
    if (b === 1) {
        console.log('NO')
        return
    }
    console.log('YES')
    console.log(a * b, a, (a * b) + a)
}

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

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  var p = a * b;
  if (a % p) {
    var f = false;
    var k = 1;
    while (!f && k < 10) {
      for (var i = 1; i < b * k && !f; i++) {
        var d = b * k - i;
        if (a * (i + d) === p && i !== d) {
          print('YES');
          print(a * i, a * d, p);
          f = true;
        }
      }
      p += p;
      k++;
    }
  } else
  print('NO');
}

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // pr(a,b,p);
    if (a == 1) {
        if (b == 1) {
            pr('YES');
            pr(2, 4, 6);
            return;
        } else if (b == 2) {
            pr('YES');
            pr(1, 3, 4);
            return;
        }
    }
    for (let z = p, rz = 1; z <= MAX; z *= p, rz++) {
        // if (rz > 1 && z == p) break;
        // pr(z);
        for (let x = a, rx = 1; x < z; x *= a, rx++) {
            // if (rx > 1 && x == a) break;
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x && x != z && y != z)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // pr(a,b,p);
    if (a == 1 && b == 1) {
        pr('YES');
        pr(2, 4, 6);
        return;
    }
    for (let z = p, rz = 1; z <= MAX; z *= p, rz++) {
        if (rz > 1 && z == p) break;
        // pr(z);
        for (let x = a, rx = 1; x < z; x *= a, rx++) {
            if (rx > 1 && x == a) break;
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x && x != z && y != z)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // pr(a,b,p);
    for (let z = p, rz = 1; z <= MAX; z *= p, rz++) {
        if (rz > 1 && z == p) break;
        // pr(z);
        for (let x = a, rx = 1; x < z; x *= a, rx++) {
            if (rx > 1 && x == a) break;
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x && x != z && y != z)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // if (a == 1 && b == 2) {
    //     pr('YES');
    //     pr(1, 1, 2);
    //     return;
    // }
    // pr(a,b,p);
    for (let z = p, rz = 1; z <= MAX; z *= p, rz++) {
        if (rz > 1 && z == p) break;
        // pr(z);
        for (let x = a, rx = 1; x < z; x *= a, rx++) {
            if (rx > 1 && x == a) break;
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x && y > 0)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // if (a == 1 && b == 2) {
    //     pr('YES');
    //     pr(1, 1, 2);
    //     return;
    // }
    // pr(a,b,p);
    for (let z = p, rz = 1; z <= MAX; z *= p, rz++) {
        if (rz > 1 && z == p) break;
        pr(z);
        for (let x = a, rx = 1; x < z; x *= a, rx++) {
            if (rx > 1 && x == a) break;
            let y = z - x;
            pr(x, y);
            if (y % a == 0 && (y != x && x != z)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // if (a == 1 && b == 2) {
    //     pr('YES');
    //     pr(1, 1, 2);
    //     return;
    // }
    // pr(a,b,p);
    for (let z = p, rz = 1; z <= MAX; z *= p, rz++) {
        if (rz > 1 && z == p) break;
        // pr(z);
        for (let x = a, rx = 1; x < z; x *= a, rx++) {
            if (rx > 1 && x == a) break;
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    if (a == 1 && b == 2) {
        pr('YES');
        pr(1, 1, 2);
        return;
    }
    // pr(a,b,p);
    for (let z = p; z <= MAX && p != 1; z *= p) {
        // pr(z);
        for (let x = a; x < z && a != 1; x *= a) {
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    // pr(a,b,p);
    for (let z = p; z <= MAX && p != 1; z *= p) {
        // pr(z);
        for (let x = a; x < z && a != 1; x *= a) {
            let y = z - x;
            // pr(x, y);
            if (y % a == 0 && (y != x)) {
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

///////////////////////////////// pre-define ////////////////////////////////////////////////////////////////////////////////
const pr = console.log;
const mi = Math.min;
const mx = Math.max;
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 gcd = (a, b) => b == 0 ? a : gcd(b, a % b);
const lcm = (a, b) => (a / gcd(a, b)) * b;
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 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 MAX = BigInt(10 ** 18);
const solve = (a, b) => {
    let p = a * b;
    for (let z = p; z <= MAX; z *= p) {
        for (let x = a; x < z; x *= a) {
            let y = z - x;
            if (y % a == 0) {
                flag = 1;
                pr('YES');
                pr(x.toString(), y.toString(), z.toString());
                return;
            }
        }
    }
    pr('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 => BigInt(x)));
    });
    rl.on('close', () => {
        let t = input[0][0];
        let i = 1;
        while (t--) {
            solve(input[i][0], input[i][1]);
            i++;
        }
    });
};

main()

// pr(60 / (5 * 3));
// pr(208 / (13 * 2));
// pr(154 / (7 * 11));

// pr(50 / 5, 10 / 5, 60 / 5);
// pr(169 / 13, 39 / 13, 208 / 13);
// pr(154 / 7, 28 / 7, 182 / 7);

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}

const solve = () => {
  const gcd = (a, b) => (a % b === 0 ? b : gcd(b, a % b));
  let t = parseInt(readline());
  while (t--) {
       let [n,k] = readline().trim().split(" ").map(cur=>parseInt(cur));
       if(k===1) console.log("NO");
       else{
            console.log("YES");
            if(k===2) console.log(`${3*n} ${5*n} ${8*13}`);
            else console.log(`${n*(k-1)} ${n*(k+1)} ${n*k*2}`);
       }
  }
};
solve();

#!/usr/bin/env node
'use strict';

const { createInterface } = require('readline');
const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
});

const buf = [];
const prom = [];
let maxBuf = 0;
let maxProm = 0;
rl.on('line', (line) => {
  if (prom.length > 0) {
    maxProm = Math.max(maxProm, prom.length);
    const [resolve, reject] = prom.shift();
    resolve(line);
  } else {
    rl.pause();
    buf.push(line);
    maxBuf = Math.max(maxBuf, buf.length);
  }
});

rl.on('close', () => {
  // console.error({maxProm, maxBuf});
});

async function getLine() {
  return new Promise((resolve, reject) => {
    if (buf.length > 0) {
      const line = buf.shift();
      resolve(line);
    } else {
      prom.push([resolve, reject]);
      rl.resume();
    }
  });
}

/**
 *
 * @param {Number} a
 * @param {Number} b
 * @returns {Number []}
 */
function solve(a, b) {
  if (b <= 1 || a < 1) {
    return [];
  }
  if (b === 2) {
    return [4 * a, a, 3 * a];
  }
  return [a * b, a, (b-1) * a];
}

async function main() {
  const t = Number(await getLine());
  for (let i = 0; i < t; i++) {
    const [a, b] = (await getLine()).split(' ').map(Number);
    const res = solve(a, b);
    if (res.length === 3) {
      console.log('YES');
      console.log(res.join(' '));
    } else {
      console.log('NO');
    }
  }
}

if (require.main === module) {
  main();
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  var p = a * b;
  if (a % b) {
    var f = false;
    var k = 1;
    while (!f && k < 10) {
      for (var i = 1; i < b * k && !f; i++) {
        var d = b * k - i;
        if (a * (i + d) === p && i !== d) {
          print('YES');
          print(a * i, a * d, p);
          f = true;
        }
      }
      p += p;
      k++;
    }
  } else
  print('NO');
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  var p = a * b;
  if (a % b) {
    var f = false;
    for (var i = 1; i < b && !f; i++) {
      var d = b - i;
      if (a * (i + d) === p && i !== d) {
        print('YES');
        print(a * i, a * d, p);
        f = true;
      }
    }
  } else
  print('NO');
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  if (a % b) {
    var p = a * b;
    for (var i = 1; true; i++) {
      var test = i * p - a;
      if (a !== test && !(test % a) && test % p) {
        print('YES');
        print(a, test, i * p);
        break;
      }
    }
  } else
    print('NO');
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  if (a % b) {
    var p = a * b;
    for (var i = 1; true; i++) {
      var test = i * p - a;
      if (!(test % a) && test % p) {
        print('YES');
        print(a, test, i * p);
        break;
      }
    }
  } else
    print('NO');
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  if (a > 1 || b > 1) {
    var p = a * b;
    print('YES');
    print(p - a, p * 3 + a, p * 4);
  } else
    print('NO');
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  var p = a * b;
  print('YES');
  print(p - a, p * 3 + a, p * 4);
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  var p = a * b;
  print('YES');
  print(p, p * 3, p * 4);
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var line1 = readline().split(' ').map(d => parseInt(d));
  var a = line1[0];
  var b = line1[1];
  var p = a * b;
  print(p, p * 3, p * 4);
}

var tt;
tt=parseInt(readline());

while(tt--){
    var a,b,arr;
    arr=readline().split(' ');
    a=parseInt(arr[0]);
    b=parseInt(arr[1]);

    if(b==1){print("NO");}
    else{
         print("YES");
         var z=(a*b);
         var x=a;
         var y=z+a;

         print(x,y,z);
    }
}


"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
function iInpArr1() {
  return readline()
    .trim()
    .split("")
    .map((cur) => parseInt(cur));
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const sqrt = (n) => {
  let low = 1n,
    high = n,
    ans;
  while (low <= high) {
    let mid = (low + high) / 2n;
    if (mid * mid <= n) {
      ans = mid;
      low = mid + 1n;
    } else high = mid - 1n;
  }
  return ans;
};

const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let arr1 = stringArr();
    let b = [],
      r = [];
    for (let i = 0; i < n; i++)
      arr1[i] === "B" ? b.push(arr[i]) : r.push(arr[i]);
    const helper = () => {
      let res = 1;
      if (b.length >= 2) b.sort((a, b) => a - b);
      for (let i = 0; i < b.length; i++) {
        if (b[i] < res) return "NO";
        res++;
      }

      if (r.length >= 2) if (r.length >= 2) r.sort((a, b) => a - b);
      for (let i = 0; i < r.length; i++) {
        if (r[i] > res) return "NO";
        res++;
      }

      return "YES";
    };
    console.log(helper());
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const a = rna();
		const c = rl().split('');

		const inc = [], dec = [];
		for (let i = 0; i < n; i++) {
			if (c[i] == 'B') {
				dec.push(a[i]);
			} else {
				inc.push(a[i]);
			}
		}

		inc.sort((x, y) => x - y);
		dec.sort((x, y) => x - y);

		let ans = true;
		for (let i = 0; ans && i < dec.length; i++) {
			if (dec[i] < i+1)
				ans = false;
		}

		for (let i = 0; ans && i < inc.length; i++) {
			if (inc[i] > dec.length + i + 1) {
				ans = false;
			}
		}

		console.log(ans ? 'YES' : 'NO');
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const readLine = () => dataitr.next().value.trim();
function rl () {
	let ans = readLine().split(' ');
	if (!isNaN(Number(ans[0]))) ans = ans.map(x => Number(x));
	return ans.length == 1 ? ans[0] : ans;
}

function main () {
	let t = rl();
	while (t--) {
		let n = rl();
		let a = readLine().split(' ').map(x => Number(x));
		let s = rl();

		let b = [], r = [];
		for (let i = 0; i < n; i++) {
			(s[i] == 'B' ? b : r).push(a[i]);
		}

		b.sort((x, y) => x - y);
		r.sort((x, y) => x - y);

		ok = true;
		for (let i = 0; ok && i < b.length; i++)
			if (b[i] < i + 1) ok = false;

		for (let i = b.length; ok && i < n; i++)
			if (r[i - b.length] > i + 1) ok = false;

		ans = ok ? 'YES':'NO';
		console.log(ans);
	}
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INF = Number.MAX_SAFE_INTEGER;
const INIT = -1;
let n;
let a;
let s;
function can() {
    const up = [];
    const down = [];
    for (let i = 0; i < n; i++) {
        if (s[i] == 'B') {
            down.push(a[i]);
        }
        else {
            up.push(a[i]);
        }
    }
    up.sort((a, b) => a - b);
    down.sort((a, b) => a - b);
    let l = 0;
    let r = 0;
    //  printf("%j\n", up);
    //  printf("%j\n", down);
    for (let i = 1; i <= n; i++) {
        while (l < down.length && down[l] < i) {
            l++;
        }
        if (l < down.length && down[l] >= i) {
            l++;
            continue;
        }
        if (r < up.length && up[r] <= i) {
            r++;
            continue;
        }
        return false;
    }
    return true;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        a = af(n);
        for (let i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        s = nextStr();
        //    printf("%j\n", a);
        if (can()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}

{
    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();
        });

        solve();
    });
    function readLine() {
        return inputString[currentLine++];
    }
}
/*
*solve here
*/
function solve() {
    let t = parseInt(readLine());
    while (t--) {
        let n = readLine();
        let a = readLine().split(" ");
        let c = readLine().split("");
        let l = [], r = [];
        for (let i = 0; i < a.length; i++) {
            (c[i] === 'B' ? l : r).push(a[i])
        }
        l.sort((a, b) => a - b);
        r.sort((a, b) => b - a);
        let flag = true;
        for (let i = 0; i < l.length; i++) {
            if (l[i] < (i + 1)) {
                flag = false;
            }
        }
        for (let i = 0; i < r.length; i++) {
            if (r[i] > (n - i)) {
                flag = false;
            }
        }
        console.log(flag ? "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++];
}

function main() {
    let t = Number(readline())
    for (let j = 1; j <= t; j++) {
        let n = Number(readline())
        let a = readline().split(' ').map(Number);
        let s = readline();
        let ok = 1;
        let D = [];
        let I = [];
        for (let i = 0; i < n; i++)
            if (s[i] == 'B')
                D.push(a[i]);
            else
                I.push(a[i]);
        D.sort((a, b) => a - b)
        I.sort((a, b) => a - b)
        let pd = 0, pi = 0;
        let ld = D.length;
        let li = I.length;
        for (let i = 1; i <= n; i++) {
            if (pd < ld && D[pd] >= i)
                pd++;
            else if (pi < li && I[pi] <= i)
                pi++;
            else
                ok = 0;
        }
        if (ok)
            console.log("YES");
        else
            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++];
}

function gcd(a, b) {
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
// let a=readline().split(' ').map(Number)
// a.sort((a,b)=>a-b)

function main() {
    let t = Number(readline())
    for (let j = 1; j <= t; j++) {
        let n = Number(readline())
        let a = readline().split(' ').map(Number);
        let s = readline();
        let ok = 1;
        let D = [];
        let I = [];
        for (let i = 0; i < n; i++)
            if (s[i] == 'B')
                D.push(a[i]);
            else
                I.push(a[i]);
        D.sort((a, b) => a - b)
        I.sort((a, b) => a - b)
        let pd = 0, pi = 0;
        let ld = D.length;
        let li = I.length;
        for (let i = 1; i <= n; i++) {
            if (pd < ld && D[pd] >= i)
                pd++;
            else if (pi < li && I[pi] <= i)
                pi++;
            else
                ok = 0;
        }
        if (ok)
            console.log("YES");
        else
            console.log("NO");
    }
}

var a=readline();
function mergeSort(array) {
        if (array == null) {
            return;
        }

        if (array.length > 1) {
            var mid = parseInt(array.length / 2);

            // Split left part
            var left = Array(mid).fill(0);
            for (i = 0; i < mid; i++) {
                left[i] = array[i];
            }

            // Split right part
            var right = Array(array.length - mid).fill(0);
            for (i = mid; i < array.length; i++) {
                right[i - mid] = array[i];
            }
            mergeSort(left);
            mergeSort(right);

            var i = 0;
            var j = 0;
            var k = 0;

            // Merge left and right arrays
            while (i < left.length && j < right.length) {
                if (left[i] < right[j]) {
                    array[k] = left[i];
                    i++;
                } else {
                    array[k] = right[j];
                    j++;
                }
                k++;
            }
            // Collect remaining elements
            while (i < left.length) {
                array[k] = left[i];
                i++;
                k++;
            }
            while (j < right.length) {
                array[k] = right[j];
                j++;
                k++;
            }
        }
        return array;
}

function getObj(arr,str) {
	var red=[];
	var blue=[];
	for (var i = 0; i < arr.length; i++) {
		if(str[i]=="B"){
			blue.push(arr[i]);
		}else{
			red.push(arr[i]);
		}
	}
	red=mergeSort(red);
	blue=mergeSort(blue);
	var isTrue=true;
	for (var i = 1; i < arr.length+1; i++) {
		if(i<=blue.length){
			if(i>blue[i-1]){
				isTrue=false;
				break;
			}
		}else{
			if((i)<red[i-1-blue.length]){
				isTrue=false;
				break;
			}
		}
	}
	if(isTrue){
		return "yes";
	}else{
		return "no";
	}
}

for(var q=0;q<a;q++){
    var b=readline();
    var c=readline().split(" ").map(Number);
    var d=readline();

    print(getObj(c,d));

}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const readLine = () => dataitr.next().value.trim();
function rl () {
	let ans = readLine().split(' ');
	if (!isNaN(Number(ans[0]))) ans = ans.map(x => Number(x));
	return ans.length == 1 ? ans[0] : ans;
}

function main () {
	let t = rl();
	while (t--) {
		let n = rl();
		let a = readLine().split(' ').map(x => Number(x));
		let s = rl();

		let b = [], r = [];
		for (let i = 0; i < n; i++) {
			(s[i] == 'B' ? b : r).push(a[i]);
		}

		b.sort((x, y) => x - y);
		r.sort((x, y) => x - y);

		ok = true;
		console.log(b, r, a, s)
		for (let i = 0; ok && i < b.length; i++)
			if (b[i] < i + 1) ok = false;

		for (let i = b.length; ok && i < n; i++)
			if (r[i - b.length] > i + 1) ok = false;

		ans = ok ? 'YES':'NO';
		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const readLine = () => dataitr.next().value.trim();
function rl () {
	let ans = readLine().split(' ');
	if (!isNaN(Number(ans[0]))) ans = ans.map(x => Number(x));
	return ans.length == 1 ? ans[0] : ans;
}

function main () {
	let t = rl();
	while (t--) {
		let n = rl();
		let a = rl();
		let s = rl();

		let b = [], r = [];
		for (let i = 0; i < n; i++) {
			(s[i] == 'B' ? b : r).push(a[i]);
		}

		b.sort((x, y) => x - y);
		r.sort((x, y) => x - y);

		ok = true;
		for (let i = 0; ok && i < b.length; i++)
			if (b[i] < i + 1) ok = false;

		for (let i = b.length; ok && i < n; i++)
			if (r[i - b.length] > i + 1) ok = false;

		ans = ok ? 'YES':'NO';
		console.log(ans);
	}
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const readLine = () => dataitr.next().value.trim();
function rl () {
	let ans = readLine().split(' ');
	if (!isNaN(Number(ans[0]))) ans = ans.map(x => Number(x));
	return ans.length == 1 ? ans[0] : ans;
}

function main () {
	let t = rl();
	while (t--) {
		let n = rl();
		let a = rl();
		let s = rl();

		let b = [], r = [];
		for (let i = 0; i < n; i++) {
			if (s[i] == 'B' )
				b.push(a[i]);
			else r.push(a[i]);
		}

		b.sort((x, y) => x - y);
		r.sort((x, y) => x - y);

		ok = true;
		for (let i = 0; ok && i < b.length; i++)
			if (b[i] < i + 1) ok = false;

		for (let i = b.length; ok && i < n; i++)
			if (r[i - b.length] > i + 1) ok = false;

		ans = ok ? 'YES':'NO';
		console.log(ans);
	}
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INF = Number.MAX_SAFE_INTEGER;
const INIT = -1;
let n;
let a;
let s;
function can() {
    const up = [];
    const down = [];
    for (let i = 0; i < n; i++) {
        if (s[i] == 'B') {
            down.push(a[i]);
        }
        else {
            up.push(a[i]);
        }
    }
    up.sort();
    down.sort();
    let l = 0;
    let r = 0;
    for (let i = 1; i <= n; i++) {
        while (l < down.length && down[l] < i) {
            l++;
        }
        if (l < down.length && down[l] >= i) {
            l++;
            continue;
        }
        if (r < up.length && up[r] <= i) {
            r++;
            continue;
        }
        return false;
    }
    return true;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        a = af(n);
        for (let i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        s = nextStr();
        if (can()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INF = Number.MAX_SAFE_INTEGER;
const INIT = -1;
let n;
let a;
let s;
function can() {
    const up = [];
    const down = [];
    for (let i = 0; i < n; i++) {
        if (s[i] == 'B') {
            down.push(a[i]);
        }
        else {
            up.push(a[i]);
        }
    }
    up.sort();
    down.sort();
    let l = 0;
    let r = 0;
    for (let i = 1; i <= n; i++) {
        while (down[l] < i) {
            l++;
        }
        if (down[l] >= i) {
            l++;
            continue;
        }
        if (up[r] <= i) {
            r++;
            continue;
        }
        return false;
    }
    return true;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        n = nextInt();
        a = af(n);
        for (let i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        s = nextStr();
        if (can()) {
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
}

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
function iInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => parseInt(cur));
}
function BInpArr() {
  return readline()
    .trim()
    .split(" ")
    .map((cur) => BigInt(cur));
}
function string() {
  return readline().trim();
}
function stringArr() {
  return readline().trim().split("");
}

function stringArr1() {
  return readline().trim().split(" ");
}
function getValue() {
  return parseInt(readline());
}
function iInpArr1() {
  return readline()
    .trim()
    .split("")
    .map((cur) => parseInt(cur));
}
let mod = 1e9 + 7;
mod = BigInt(mod);
const pow = (num, exp, mod) => {
  if (exp === BigInt(0)) return BigInt(1);
  let x = pow(num, exp / BigInt(2), mod);
  if (exp % BigInt(2)) return (((x * x) % mod) * num) % mod;
  else return (x * x) % mod;
};
const inverse = (num, exp) => {
  return pow(BigInt(num), BigInt(exp), BigInt(mod));
};
const sqrt = (n) => {
  let low = 1n,
    high = n,
    ans;
  while (low <= high) {
    let mid = (low + high) / 2n;
    if (mid * mid <= n) {
      ans = mid;
      low = mid + 1n;
    } else high = mid - 1n;
  }
  return ans;
};

const solve = () => {
  let t = getValue();
  while (t--) {
    let n = getValue();
    let arr = iInpArr();
    let arr1 = stringArr();
    let b = [],
      r = [];
    for (let i = 0; i < n; i++)
      arr1[i] === "B" ? b.push(arr[i]) : r.push(arr[i]);
    const helper = () => {
      let res = 1;
      if (b.length >= 2) {
        b.sort((a, b) => a - b);
        for (let i = 0; i < b.length; i++) {
          if (b[i] < res) return "NO";
          res++;
        }
      }
      if (r.length >= 2) {
        if (r.length >= 2) r.sort((a, b) => a - b);
        for (let i = 0; i < r.length; i++) {
          if (r[i] > res) return "NO";
          res++;
        }
      }
      return "YES";
    };
    console.log(helper());
  }
};
solve();

var a=readline();
function mergeSort(array) {
        if (array == null) {
            return;
        }

        if (array.length > 1) {
            var mid = parseInt(array.length / 2);

            // Split left part
            var left = Array(mid).fill(0);
            for (i = 0; i < mid; i++) {
                left[i] = array[i];
            }

            // Split right part
            var right = Array(array.length - mid).fill(0);
            for (i = mid; i < array.length; i++) {
                right[i - mid] = array[i];
            }
            mergeSort(left);
            mergeSort(right);

            var i = 0;
            var j = 0;
            var k = 0;

            // Merge left and right arrays
            while (i < left.length && j < right.length) {
                if (left[i] < right[j]) {
                    array[k] = left[i];
                    i++;
                } else {
                    array[k] = right[j];
                    j++;
                }
                k++;
            }
            // Collect remaining elements
            while (i < left.length) {
                array[k] = left[i];
                i++;
                k++;
            }
            while (j < right.length) {
                array[k] = right[j];
                j++;
                k++;
            }
        }
        return array;
}

function getObj(arr,str) {
	var red=[];
	var blue=[];
	for (var i = 0; i < arr.length; i++) {
		if(str[i]=="B"){
			blue.push(arr[i]);
		}else{
			red.push(arr[i]);
		}
	}
	red=mergeSort(red);
	blue=mergeSort(blue);
	var isTrue=true;
	for (var i = 1; i < arr.length+1; i++) {
		if(i<=blue.length){
			if(i>blue[i-1]){
				isTrue=false;
				break;
			}
		}else{
			if((i)<red[i-1-blue.length]){
				isTrue=false;
				break;
			}
		}
	}
	if(isTrue){
		return "yes";
	}else{
		return "no";
	}
}

for(var q=0;q<a;q++){
    var b=readline();
    var c=readline().split(" ");
    var d=readline();

    print(getObj(c,d));

}


var q = readline();

for(var i = 0; i < q; i++) {
    var x = readline().split(" ");
    var a = x[0];
    var b = x[1];
    var n = x[2];

    if(n % 3 === 0) print(a);
    else if(n % 3 == 1) print(b);
    else print(a ^ b);

}

process.stdin.resume()
process.stdin.setEncoding('utf8')
let arr = "";
let numbers = []
process.stdin.on('data', function(chunk) {
  arr += chunk;
});

process.stdin.on('end', () => {
  arr = arr.split("\n");
  var n = parseInt(arr.shift())
  for(let i=0;i<n;i++){
    var c = arr[i].split(" ")
    var a = parseInt(c[0])
    var b = parseInt(c[1])
    var no = parseInt(c[2])
    var term = [a, b, a ^ b]
    numbers.push(term[no % 3])
  }
  for(let i = 0; i < numbers.length; i++){
    console.log(numbers[i])
  }
})

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 [a, b, n] = d.split(' ').map(Number);
  const ans = [a, b, a ^ b];
  console.log(ans[n % 3]);

  c++;
});

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

const sol = () => {
	let line = data.split('\n');
	let n = parseInt(line[0], 10);
	let result = [];
	for(let i = 0; i < n; i++){
		let [a, b, k] = line[i+1].split(' ').map(v => parseInt(v,10));
		result.push([a, b, a ^ b][k%3]);
	}
	console.log(result.join('\n'));
};
process.stdin.on('end', sol);

function input() {
  var n = parseInt(readline().trim());
  return Array(n)
    .fill(0)
    .map(function() {
      return readline()
        .trim()
        .split(" ")
        .map(function(i) {
          return parseInt(i);
        });
    });
}

function solve(a, b, n) {
  if (n % 3 === 0) return a;
  if (n % 3 === 1) return b;
  return a ^ b;
}

function main() {
  // get input
  var read = input();

  for (var i = 0; i < read.length; i++) {
    print(solve(read[i][0], read[i][1], read[i][2]));
  }
}

main();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var T = rdN();
    while (T --> 0) {
        var input = rdArN();
        var a = input[0].toString(2).split('').reverse();
        var b = input[1].toString(2).split('').reverse();
        var n = input[2]%3;

        var res = [];
        var F = [
            [
                [0, 0],
                [1, 1]
            ],
            [
                [0, 1],
                [0, 1]
            ],
            [
                [0, 1],
                [1, 0]
            ],
        ]
        for (var i = 0; i < a.length || i < b.length; ++i) {
            var f0 = a[i] || 0;
            var f1 = b[i] || 0;
            var fn = F[n][f0][f1];

            res.push(fn);
        }
        pr(parseInt(res.reverse().join(''), 2));
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

process.stdin.resume()
process.stdin.setEncoding('utf8')
let arr = "";
let numbers = []
process.stdin.on('data', function(chunk) {
  arr += chunk;
});

process.stdin.on('end', () => {
  arr = arr.split("\n");
  var n = parseInt(arr.shift())
  console.log(n)
  for(let i=0;i<n;i++){
    var c = arr[i].split(" ")
    var a = parseInt(c[0])
    var b = parseInt(c[1])
    var no = parseInt(c[2])
    var term = [a, b, a ^ b]
    console.log(term)
    numbers.push(term[no % 3])
  }
  console.log(n, numbers)
  for(let i = 0; i < numbers.length; i++){
    console.log(numbers[i])
  }
})

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;
  }

  let [a, b, n] = d.split(' ').map(Number);

  if (n === 0) {
    console.log(a);
    return;
  }
  else if (n === 1) {
    console.log(b);
    return;
  }

  console.log(a ^ b);

  c++;
});

function input() {
  var n = parseInt(readline().trim());
  return Array(n)
    .fill(0)
    .map(function() {
      return readline()
        .trim()
        .split(" ")
        .map(function(i) {
          return parseInt(i);
        });
    });
}

function solve(a, b, n) {
  if (n == 0) return a;
  if (n == 1) return b;

  var check = {
    [a]: 0,
    [b]: 1
  };

  var reverse = {
    0: a,
    1: b
  };

  var count = 2;

  while (true) {
    var next = a ^ b;
    if (check[next] !== undefined) {
      return reverse[n % count];
    }
    check[next] = count;
    reverse[count] = next;
    a = b;
    b = next;
    count += 1;
  }
}

function main() {
  // get input
  var read = input();

  for (var i = 0; i < read.length; i++) {
    print(solve(read[i][0], read[i][1], read[i][2]));
  }
}

main();

process.stdin.resume()
process.stdin.setEncoding('utf8')
let arr = "";
let numbers = []
process.stdin.on('data', function(chunk) {
  arr += chunk;
});

process.stdin.on('end', () => {
  arr = arr.split("\n");
  var n = parseInt(arr.shift())
  for(let i=0;i<n;i++){
    var c = arr[i].split(" ")
    var a = parseInt(c[0])
    var b = parseInt(c[1])
    var term = [a, b, a ^ b]
    numbers.push(term[c[2] % 3])
  }
})
for(let i = 0; i < numbers.length; i++){
  console.log(numbers[i])
}

process.stdin.resume()
process.stdin.setEncoding('utf8')
let arr = "";
let numbers = []
process.stdin.on('data', function(chunk) {
  arr += chunk;
});

process.stdin.on('end', () => {
  arr = arr.split("\n");
  var n = parseInt(arr.shift())
  for(let i=0;i<n;i++){
    var c = arr[i].split(" ")
    var a = parseInt(c[0])
    var b = parseInt(c[1])
    var n = parseInt(c[2])
    var term = [a, b, a ^ b]
    numbers.push(term[n % 3])
  }
  for(let i = 0; i < numbers.length; i++){
    console.log(numbers[i])
  }
})


var stdin_input = "";
var stdin_input_itr;
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { stdin_input_itr = stdin_input.split('\n').values(); main(); });

const rl = () => stdin_input_itr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

const MOD = 1e9+7;

const B = n => BigInt(n);

function fact (n) {
	let res = 1;
	for (let i = 1; i <= n; i++) res = res * i % MOD;
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const a = rna();

		let and = ~0;
		for (let i = 0; i < n; i++) and &= a[i];

		let cnt = 0;
		for (let i = 0; i < n; i++) cnt += a[i] == and;

		const ans = B(cnt*(cnt-1)) * B(fact(n-2)) % B(MOD);
		console.log(ans.toString());
	}
}

'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++];
}

var maxN = 2 * 1e5 + 10
var mod = BigInt(1e9 + 7)

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

function main() {
  const xx = readline();
  Array(Number(xx)).fill(1).map((t, i) => {
    var n = parseInt(readline());
    // var [n, m] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // })
    // var [x, y] = readline().split(' ').map((x, iii) => {
    //   return parseInt(x)
    // });
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    var x = a[0]
    for (let j = 0; j < n; j++) {
      x = x & a[j]
    }

    var cmt = 0
    for (let j = 0; j < n; j++) {
      cmt = cmt + (a[j] === x ? 1 : 0)
    }
    var ans = 1n
    ans = ((BigInt(cmt) * BigInt(cmt - 1)) / 2n * 2n) % mod

    for (let j = 1; j <= n - 2; j++) {
      ans = (ans * BigInt(j)) % mod
    }

    console.log(ans.toString())

  })
}

var stdin_input = "";
var stdin_input_itr;
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { stdin_input_itr = stdin_input.split('\n').values(); main(); });

const rl = () => stdin_input_itr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

const MOD = BigInt(1e9+7);

function fact (n) {
	let res = 1n;
	for (let i = 1n; i <= n; i++) res = res * i % MOD;
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const a = rna();

		let and = a[0];
		for (let i = 0; i < n; i++) and &= a[i];

		let cnt = 0;
		for (let i = 0; i < n; i++) cnt += a[i] == and;

		const ans = BigInt(cnt*(cnt-1))*fact(n-2)%MOD;
		console.log(ans.toString());
	}
}

var stdin_input = "";
var stdin_input_itr;
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { stdin_input_itr = stdin_input.split('\n').values(); main(); });

const rl = () => stdin_input_itr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

var deb; const log = msg => (typeof deb != "undefined") && console.log("DEBUG", msg);

const MOD = 1e9+7;

function fact (n) {
	let res = 1;
	for (let i = 1; i <= n; i++) res = res * i % MOD;
	return res;
}

function main () {
	let T = rn();
	while (T--) {
		const n = rn();
		const a = rna();

		let and = a[0];
		for (let i = 0; i < n; i++) and &= a[i];

		let cnt = 0;
		for (let i = 0; i < n; i++) cnt += a[i] == and;

		console.log(cnt*(cnt-1)*fact(n-2)%MOD+0);
	}
}


(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var A = rdArN();
    var m = rdN();
    var B = rdArN();
    for (var i = 0; i < n; ++i) {
        for (var j = 0; j < m; ++j) {
            var s = A[i] + B[j];
            if (A.indexOf(s) === -1 && B.indexOf(s) === -1) {
                wr(A[i], B[j]);
                return;
            }
        }
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

var a = parseInt(readline().trim());
var numbers1 = readline().trim().split(" ").map(function(x) { return parseInt(x); });
var mx1 = Math.max.apply(null, numbers1);
var b = parseInt(readline().trim());
var numbers2 = readline().trim().split(" ").map(function(x) { return parseInt(x); });
var mx2 = Math.max.apply(null, numbers2);
print(mx1 + " " + mx2);

var n = Number(readline());
var a = readline();
a = a.split(' ');
a = a.map((x) => Number(x));
var m = Number(readline());
var b = readline();
b = b.split(' ');
b = b.map((x) => Number(x));
a.sort((x, y) => x - y);
b.sort((x, y) => x - y);
print(String(a[n - 1]) + " " + String(b[m - 1]));

function main() {
    const [n, a, m, b] = stdin;
    const A = a.split(' ').map(Number);
    const B = b.split(' ').map(Number);
    const C = new Set(A.concat(B));
    for (let i = 0; i < A.length; i++) {
        for (let j = 0; j < B.length; j++) {
            if (!C.has(A[i] + B[j])) {
                console.log(A[i], B[j]);
                return
            }
        }
    }
}

const readline = require('readline');
const rl = readline.createInterface({input: process.stdin});
var stdin = [];
rl.on('line', function (line) {
    stdin.push(line);
});
rl.on('close', main);

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error('\n');
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr('time : ' + end + 'ms');
  myerr('memory : ' + Math.round(process.memoryUsage().heapTotal / 1024) + 'KB');
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
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){console.log(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 N = nextInt();
  var alist = nextIntArray();
  var M = nextInt();
  var blist = nextIntArray();
  for(var i = 0; i < N; i++){
    for(var j = 0; j < M; j++){
      var sum = alist[i] + blist[j];
      if(alist.indexOf(sum) == -1 && blist.indexOf(sum) == -1){
        myout(alist[i] + " " + blist[j]);
        return;
      }
    }
  }
}

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*/
  processData(lines)
})

const processData = (lines) => {
  const [n, a, m, b] = lines

  const A = a.split(' ').map(n => Number(n))
  const B = b.split(' ').map(n => Number(n))

  const C = new Set(A.concat(B))

  for (let i = 0; i < A.length; i++) {
    for (let j = 0; j < B.length; j++) {
      if (!C.has(A[i] + B[j])) {
        console.log(A[i], B[j])
        return
      }
    }
  }
}

let input ='';

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data',(data)=>input+=data)
process.stdin.on('end',()=>{
   input = input.split('\n')
   let maxA = 0;
   input[1].split(' ').forEach((item)=>{
		item = parseInt(item)
		if(item>maxA) maxA = item
		})
  let maxB = 0;
  input[3].split(' ').forEach((item)=>{
        item = parseInt(item)
		if(item>maxB) maxB = item
		})
    console.log(maxA,maxB)

})

const readline = require('readline');

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

let len1, len2, arr1 = [], arr2 = []

rl.question('', (answer) => {
  len1 = Number(answer);
  rl.question('', (answer) => {
    arr1 = (answer.split(' ').slice(0, len1)).map((x) => Number(x))

    rl.question('', (answer) => {
      len2 = Number(answer);
      rl.question('', (answer) => {
        arr2 = (answer.split(' ').slice(0, len2)).map((x) => Number(x));
        //here call function
        console.log(check(arr1, arr2).join(' '));
      })
    });

  })
});

function check(a, b) {
//   console.log('*************');
//   console.log(arr1);
//   console.log(arr2);
  for (let i = 0; i < a.length; i++) {
    for (let k = 0; k < b.length; k++) {
      const sum = a[i] + b[k]
      if (!a.includes(sum) && !b.includes(sum)) {
        return [a[i], b[k]]
      }
    }
  }
  return [];
}

const readline = require('readline');
const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});
let c = 0;
let a, b;

rl.on('line', (d) => {
  if (c === 1) {
    a = d.split(' ').map(Number).sort((a, b) => b - a)[0];
  }

  if (c === 3) {
    b = d.split(' ').map(Number).sort((a, b) => b - a)[0];
  }

  c++;
});

rl.on('close', () => {
  console.log(a, b);
});

const readline = require('readline');

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

rl.question('', function (arr1Size) {
  rl.question('', function (arr1) {
    rl.question('', function (arr2Size) {
      rl.question('', function (arr2) {
        let notBelongs = [];
        arr1 = arr1.split(' ').map(Number)
        arr2 = arr2.split(' ').map(Number)
        arr1Size = Number(arr1Size)
        arr2Size = Number(arr2Size)
        arr1.map(aNum => {
          arr2.map(bNum => {
            if (!arr1.includes(aNum + bNum) && !arr2.includes(aNum + bNum)) {
              notBelongs.push([aNum, bNum]);
            }
          });
        });
        console.log(notBelongs[0].join(' ').trim())
      });
    });
  });
});

var n = readline();
var a = readline().split(" ").map(function(x) { return parseInt(x); });;
var m = readline();
var b = readline().split(" ").map(function(x) { return parseInt(x); });;

var flag = 0;
for (var i = 0; i < n; i++) {
    for (var j = 0; j < m; j++) {

        var sum = parseInt(a[i]) + parseInt(b[j]);
        if(!a.includes(sum) && !b.includes(sum)){
            print(a[i] + ' ' + b[j]);
            flag = 1;
            break;
        }
        else
            continue;
    }
    if(flag == 1)
        break;
}

function input() {
  return [
    parseInt(readline().trim()),
    readline()
      .trim()
      .split(" ")
      .map(function(i) {
        return parseInt(i);
      }),
    parseInt(readline().trim()),
    readline()
      .trim()
      .split(" ")
      .map(function(i) {
        return parseInt(i);
      })
  ];
}

function main() {
  // get input
  var read = input();
  var a = read[1];
  var b = read[3];

  var done = false;

  a.forEach(function(i) {
    if (done) return 0;
    b.forEach(function(j) {
      if (done) return 0;
      if (a.indexOf(i + j) < 0 && b.indexOf(i + j) < 0) {
        print(i, j);
        done = true;
      }
    });
  });
}

main();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var a = rdArN().sortGt()[0];
    var m = rdN();
    var b = rdArN().sortGt()[0];
    wr(a, b);

};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    const f = parseInt(readLine().split(' '), 10)

    const firstL = readLine().split(' ').map(item => parseInt(item,10))
   const s = parseInt(readLine().split(' '), 10)
    const secondL = readLine().split(' ').map(item => parseInt(item,10))

    let uniqueSum = 0

    for(let i = 1; i < f ; i++){
        let current = firstL[i]
        let index = i

        while(index >= 0 && current < firstL[index - 1]){
            firstL[index] = firstL[index - 1]
            index--
        }
        firstL[index] = current
    }
    for(let j = 1; j < s; j++){
        let current = secondL[j];
        let index = j;

        while(index >= 0 && current < secondL[index -1 ]){
            secondL[index] = secondL[index -1 ];
            index--
        }
    }

    let array = [firstL.pop(), secondL.pop()];

    console.log(array.join(' '))

}

//var input = readline()

var Max = -9, MAX =-9;
var t = parseInt(readline());
var ar = readline().split(' ').map(x => parseInt(x));
Max = Math.max(...ar);

var k = parseInt(readline());
var arr = readline().split(' ').map(x => parseInt(x));
MAX = Math.max(...arr);

print(Max +' ' + MAX);

//

var n = readline();
var a = readline().split(' ');
var m = readline();
var b = readline().split(' ');
var flag = 0;
for (var i = 0; i < n; i++) {
    for (var j = 0; j < m; j++) {

        var sum = parseInt(a[i]) + parseInt(b[j]);
        if(!a.includes(sum) || !b.includes(sum)){
            print(a[i] + ' ' + b[j]);
            flag = 1;
            break;
        }
        else
            continue;
    }
    if(flag == 1)
        break;
}

var n = readline();
var a = readline().split(' ');
var m = readline();
var b = readline().split(' ');
var flag = 0;
for (var i = 0; i < n; i++) {
    for (var j = 0; j < m; j++) {

        var sum = parseInt(a[i]) + parseInt(b[j]);
        if(!a.includes(sum) && !b.includes(sum)){
            print(a[i] + ' ' + b[j]);
            flag = 1;
            break;
        }
        else
            continue;
    }
    if(flag == 1)
        break;
}

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var A = rdArN();
    var m = rdN();
    var B = rdArN();
    for (var i = 0; i < n; ++i) {
        for (var j = 0; j < m; ++j) {
            var s = A[i] + B[j];
            if (A.indexOf(s) === -1 && B.indexOf(s) === -1) {
                wr(A[i], B[i]);
                return;
            }
        }
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

(function() {
var INPUT = ``;
var OUTPUT = ``;

var main = function() {"use strict";
    // TODO
    var n = rdN();
    var A = rdArN();
    var m = rdN();
    var B = rdArN();
    for (var i = 0; i < n; ++i) {
        for (var j = i; j < m; ++j) {
            var s = A[i] + B[j];
            if (A.indexOf(s) === -1 && B.indexOf(s) === -1) {
                wr(A[i], B[i]);
                return;
            }
        }
    }
};

if(INPUT){INPUT=INPUT.split('\n').reverse();
readline=()=>INPUT.pop();
write=(...s)=>{OUTPUT+=[...s].join(' ')};
print=(...s)=>{write(...s);OUTPUT+='\n'};}
const
rdS=readline,
rdN=()=>+rdS(),
rdArS=()=>rdS().split(' '),
rdArN=()=>rdArS().map(v=>+v),
wr=write,
pr=print,
prAr=(a)=>pr(...a),
prOb=(o)=>pr(JSON.stringify(o,null,4)),
crAr=function(length,...fillArgs){return new Array(length).fill(...fillArgs);},
getPrimes=function(n){var sieve=crAr(n+1,true),primes=[],i,j;for(i=2,j=4;j<sieve.length;j=Math.pow(++i,2)){if(sieve[j]){for(;j<sieve.length;j+=i){sieve[j]=false;}}}for(i=2;i<sieve.length;++i){if(sieve[i]){primes.push(i);}}return primes;},
getPrimeFactors=function(n){var primes=getPrimes(Math.floor(Math.sqrt(n))),last=primes.push(n)-1,factors=[],i,p;for(i=0,p=primes[0];primes[last]>1;){if(primes[last]%p===0){primes[last]/=p;factors.push(p);}else{p=primes[++i];}}return factors;},
defineProperty=(o,pN,v)=>Object.defineProperty(o,pN,{value:v,writable:true,enumerable:false,configurable:true});
defineProperty(Array.prototype,'sortLt',function(){return this.sort((a,b)=>a-b);});
defineProperty(Array.prototype,'sortGt',function(){return this.sort((a,b)=>b-a);});

main();
return OUTPUT;
})();

var n = Number(readline());
var a = readline();
a = a.split(' ');
a = a.map((x) => Number(x));
var m = Number(readline());
var b = readline();
b = b.split(' ');
b = b.map((x) => Number(x));
a.sort((x) => Number(x));
b.sort((x) => Number(x));
print(String(a[n - 1]) + " " + String(b[m - 1]));

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*/
  processData(lines)
})

const processData = (lines) => {
  const [n, a, m, b] = lines

  const A = a.split(' ').map(n => Number(n))
  const B = b.split(' ').map(n => Number(n))

  const C = new Set(A.concat(B))

  for (let i = 0; i < A.length; i++) {
    for (let j = 0; j < B.length; j++) {
      if (C.has(A[i] + B[j])) {
        console.log(A[i], ' ', B[j])
        return
      }
    }
  }
}

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*/
  processData(lines)
})

const processData = (lines) => {
  const [n, a, m, b] = lines

  const A = a.split(' ').map(n => Number(n))
  const B = b.split(' ').map(n => Number(n))

  const C = new Set(A.concat(B))

  for (let i = 0; i < A.length; i++) {
    for (let j = 0; j < B.length; j++) {
      if (!C.has(A[i] + B[j])) {
        console.log(A[i], ' ', B[j])
        return
      }
    }
  }
}

const readline = require('readline');

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

let len1, len2, arr1 = [], arr2 = []

rl.question('enter arr 1 length?', (answer) => {
  len1 = Number(answer);
  rl.question('enter arr 1 values?', (answer) => {
    arr1 = (answer.split(' ').slice(0, len1)).map((x) => Number(x))

    rl.question('enter arr 2 length?', (answer) => {
      len2 = Number(answer);
      rl.question('enter arr 2 values?', (answer) => {
        arr2 = (answer.split(' ').slice(0, len1)).map((x) => Number(x));
        //here call function
        console.log(check(arr1, arr2));
      })
    });

  })
});

function check(a, b) {
  for (let i = 0; i < a.length; i++) {
    for (let k = 0; k < b.length; k++) {
      const sum = a[i] + b[k]
      if (!a.includes(sum) && !b.includes(sum)) {
        return [a[i], b[k]]
      }
    }
  }
  return [];
}

const readline = require('readline');

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

let len1, len2, arr1 = [], arr2 = []

rl.question('', (answer) => {
  len1 = Number(answer);
  rl.question('', (answer) => {
    arr1 = (answer.split(' ').slice(0, len1)).map((x) => Number(x))

    rl.question('', (answer) => {
      len2 = Number(answer);
      rl.question('', (answer) => {
        arr2 = (answer.split(' ').slice(0, len1)).map((x) => Number(x));
        //here call function
        console.log(check(arr1, arr2).join(' '));
      })
    });

  })
});

function check(a, b) {
  for (let i = 0; i < a.length; i++) {
    for (let k = 0; k < b.length; k++) {
      const sum = a[i] + b[k]
      if (!a.includes(sum) && !b.includes(sum)) {
        return [a[i], b[k]]
      }
    }
  }
  return [];
}

const readline = require('readline');

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

rl.question('arr1Size ? ', function (arr1Size) {
  rl.question('arr1 ? ', function (arr1) {
    rl.question('arr2Size ? ', function (arr2Size) {
      rl.question('arr2 ? ', function (arr2) {
          console.log(arr1Size,arr1 ,arr2Size,arr2, "wwww")
        let notBelongs = [];
        arr1 = arr1.split(' ').map(Number)
        arr2 = arr2.split(' ').map(Number)
        arr1Size = Number(arr1Size)
        arr2Size = Number(arr2Size)
        arr1.map(aNum => {
          arr2.map(bNum => {
            if (!arr1.includes(aNum + bNum) && !arr2.includes(aNum + bNum)) {
              notBelongs.push([aNum, bNum]);
            }
          });
        });
        console.log(notBelongs[0].join(' ').trim())
      });
    });
  });
});

const readline = require('readline');

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

rl.question('arr1Size ? ', function (arr1Size) {
  rl.question('arr1 ? ', function (arr1) {
    rl.question('arr2Size ? ', function (arr2Size) {
      rl.question('arr2 ? ', function (arr2) {
        let notBelongs = [];
        arr1 = arr1.split(' ').map(Number)
        arr2 = arr2.split(' ').map(Number)
        arr1Size = Number(arr1Size)
        arr2Size = Number(arr2Size)
        arr1.map(aNum => {
          arr2.map(bNum => {
            if (!arr1.includes(aNum + bNum) && !arr2.includes(aNum + bNum)) {
              notBelongs.push([aNum, bNum]);
            }
          });
        });
        console.log(notBelongs[0].join(' ').trim())
      });
    });
  });
});

const readline = require('readline');

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

rl.question('arr1Size ? ', function (arr1Size) {
  rl.question('arr1 ? ', function (arr1) {
    rl.question('arr2Size ? ', function (arr2Size) {
      rl.question('arr2 ? ', function (arr2) {
          console.log(arr1Size,arr1 ,arr2Size,arr2, "wwww")
        let notBelongs = [];
        arr1 = arr1.split(' ').map(Number)
        arr2 = arr2.split(' ').map(Number)
        arr1.map(aNum => {
          arr2.map(bNum => {
            if (!arr1.includes(aNum + bNum) && !arr2.includes(aNum + bNum)) {
              notBelongs.push([aNum, bNum]);
            }
          });
        });
        console.log(notBelongs[0].join(' ').trim())
      });
    });
  });
});

const readline = require('readline');

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

rl.question('arr1Size ? ', function (arr1Size) {
  rl.question('arr1 ? ', function (arr1) {
    rl.question('arr2Size ? ', function (arr2Size) {
      rl.question('arr2 ? ', function (arr2) {
          console.log(arr1Size,arr1 ,arr2Size,arr2, "wwww")
        let notBelongs = [];
        arr1 = arr1.split(' ').map(Number)
        arr2 = arr2.split(' ').map(Number)
        arr1.map(aNum => {
          arr2.map(bNum => {
            if (!arr1.includes(aNum + bNum) && !arr2.includes(aNum + bNum)) {
              notBelongs.push([aNum, bNum]);
            }
          });
        });
        console.log(notBelongs[0]);
        return
      });
    });
  });
});

const readline = require('readline');

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

rl.question('arr1Size ? ', function (arr1Size) {
  rl.question('arr1 ? ', function (arr1) {
    rl.question('arr2Size ? ', function (arr2Size) {
      rl.question('arr2 ? ', function (arr2) {
          console.log(arr1Size,arr1 ,arr2Size,arr2, "wwww")
        let notBelongs = [];
        arr1 = arr1.split(' ').map(Number)
        arr2 = arr2.split(' ').map(Number)
        arr1.map(aNum => {
          arr2.map(bNum => {
            if (!arr1.includes(aNum + bNum) && !arr2.includes(aNum + bNum)) {
              notBelongs.push([aNum, bNum]);
            }
          });
        });
        notBelongs[0].join(' ').trim()
      });
    });
  });
});

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.replace(/\s*$/, '')
        .split('\n')
        .map(str => str.replace(/\s*$/, ''));

    main();
});

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

function main() {
    const f = parseInt(readLine().split(' '), 10)

    const firstL = readLine().split(' ').map(item => parseInt(item,10))
   const s = parseInt(readLine().split(' '), 10)
    const secondL = readLine().split(' ').map(item => parseInt(item,10))

    let uniqueSum = 0

    for(let i = 1; i < f ; i++){
        let current = firstL[i]
        let index = i

        while(index >= 0 && current < firstL[index - 1]){
            firstL[index] = firstL[index - 1]
            index--
        }
        firstL[index] = current
    }
    for(let j = 1; j < s; j++){
        let current = secondL[j];
        let index = j;

        while(index >= 0 && current < secondL[index -1 ]){
            secondL[index] = secondL[index -1 ];
            index--
        }
    }

    uniqueSum = firstL.pop() + secondL.pop()
    console.log(uniqueSum)

}