You are given the array $$$a$$$ consisting of $$$n$$$ positive (greater than zero) integers.In one move, you can choose two indices $$$i$$$ and $$$j$$$ ($$$i \ne j$$$) such that the absolute difference between $$$a_i$$$ and $$$a_j$$$ is no more than one ($$$|a_i - a_j| \le 1$$$) and remove the smallest of these two elements. If two elements are equal, you can remove any of them (but exactly one).Your task is to find if it is possible to obtain the array consisting of only one element using several (possibly, zero) such moves or not.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases. Then $$$t$$$ test cases follow. The first line of the test case contains one integer $$$n$$$ ($$$1 \le n \le 50$$$) — the length of $$$a$$$. The second line of the test case contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 100$$$), where $$$a_i$$$ is the $$$i$$$-th element of $$$a$$$.

For each test case, print the answer: "YES" if it is possible to obtain the array consisting of only one element using several (possibly, zero) moves described in the problem statement, or "NO" otherwise.

NoteIn the first test case of the example, we can perform the following sequence of moves:  choose $$$i=1$$$ and $$$j=3$$$ and remove $$$a_i$$$ (so $$$a$$$ becomes $$$[2; 2]$$$);  choose $$$i=1$$$ and $$$j=2$$$ and remove $$$a_j$$$ (so $$$a$$$ becomes $$$[2]$$$). In the second test case of the example, we can choose any possible $$$i$$$ and $$$j$$$ any move and it doesn't matter which element we remove.In the third test case of the example, there is no way to get rid of $$$2$$$ and $$$4$$$.

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++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let len = +readLine();
    const arr = readLine()
      .split(" ")
      .map((n) => parseInt(n));

    arr.sort((a, b) => a - b);
    let count = 0;
    for (let i = 0; i < len - 1; i++) {
      if (Math.abs(arr[i] - arr[i + 1]) > 1) count++;
    }
    if (count) console.log("NO");
    else console.log("YES");
  }
}

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

let input = [];

rl.on('line', function (line) {
    input.push(line);
});

rl.on('close', function () {
    const total = Number(input[0]);
    for (let ii = 0; ii < 2*total; ii +=2) {
        let output = "Yes";
        const len = Number(input[ii+1]);
        let arr = input[ii+2].split(' ').map(x => Number(x));
        arr.sort((a, b) => a - b);
        for (let i = 0; i < total-1; i++) {
            if (arr[i + 1] - arr[i] > 1) {
                output = "No";
                break;
            }
        }
        console.log(output);
    }
});

const readline = require('readline');

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

let tests = [];
rl.on('line', (line) => {
  tests.push(line);
}).on('close', () => {
  for (ii = 1; ii < tests.length; ii+= 2) {
    const test = tests[ii + 1].split(' ').sort((a, b) => +a - +b);
    let count = 0;
    for(i = 0; i < test.length; i++) {

      if (
        !test[i + 1] ||
        Math.abs(+test[i] - +test[i + 1]) > 1
      ) {
        count++;
      }
    }
    if (count > 1) {
      process.stdout.write(`NO\n`);
    } else {
      process.stdout.write(`YES\n`);
    }
  }
});

//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 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 t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var n = nextInt();
    var list = nextIntArray();
    list.sort(function(a,b){
      return a - b;
    });
    var isOK = true;
    for(var j = 0; j < n - 1; j++){
      if(Math.abs(list[j] - list[j + 1]) > 1){
        isOK = false;
        break;
      }
    }
    output[i] = (isOK) ? "YES" : "NO";
  }
  myout(myconv(output, 9));
}

let inputString = '';
let currentLine = 0;

const runMain = () => {
  inputString = inputString.trim().split('\n').map(string => string.trim());
  main();
  process.exit();
}
const readLine = () => inputString[currentLine++];

process.stdin.on('data', inputStdin => inputString += inputStdin);
process.stdin.on('end', runMain);
process.on('SIGINT', runMain);

function main() {
  let t = readLine();
  while (t--) {
    const n = readLine();
    const a = readLine().split(' ').map(num => Number(num)).sort((a, b) => a - b);
    const res = a.reduce((acc, cur) => [cur, acc[1] + (Math.abs(acc[0] - cur) > 1 ? 1 : 0)], [a[0], 0]);
    console.log(res[1] > 0 ? 'NO' : 'YES');
  }
}

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

let stdinInput = '';

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

process.stdin.on('end', () => {
  main(stdinInput);
});

function main(data) {
	data = data.split('\n');
	const testCases = data[0] * 2;
    let i = 1;
    outer:
	while (i <= testCases) {
	  let n = data[i] * 1;
	  let a = data[i + 1].trim().split(' ').map(Number);
	  a.sort((a, b) => a - b);
	  for (let j = 1; j < n; j += 1) {
        let diff = a[j] - a[j - 1];
	    if (diff > 1) {
	      console.log('NO');
	      i += 2;
	      continue outer;
	    }
	  }
	  console.log('YES');
    i += 2;
	}
}

'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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  let t = +readline();
  for (let i = 0; i < t; i++) {
    const n = +readline();
    const a = readline().split(' ').map(x => parseInt(x)).sort((i, j) => i - j);
    let no = false;
    for (let j = 1; j < n; j++) {
      if (Math.abs(a[j] - a[j-1]) > 1) {
        print('NO\n');
        no = true;
        break;
      }
    }
    if (!no) {
      print('YES\n');
    }
  }
}

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

const input = [];

function splitAndParseInt(line) {
  return line.split(" ").map((x) => parseInt(x));
}

readLine.on("line", (line) => input.push(line));
readLine.on("close", () => {
  let t = parseInt(input[0]);

  for (let i = 1; i <= t * 2; i += 2) {
    const n = parseInt(input[i]);

    const nums = splitAndParseInt(input[i + 1]);
    nums.sort((a, b) => a - b);

    if (nums.length === 1) {
      console.log("YES");
      continue;
    }

    let cnt = 0;
    for (let i = 1; i < nums.length; i += 1) {
      if (nums[i] - nums[i - 1] <= 1) cnt += 1;
    }

    if (nums.length - cnt <= 1) {
      console.log("YES");
    } else {
      console.log("NO");
    }
  }
});

const processData = (lines) => {
    let acc = 0
    const n = +lines[acc++]
    for (let i=0; i<n; i++) {
        acc++
        const nums = lines[acc++].split(' ').map(x => +x).sort((a, b) => a-b)
        let found = false
        for (let i=0; i<nums.length-1; i++) {
            if ((nums[i+1] - nums[i]) > 1) {
                found = true
                break
            }
        }

        console.log(found ? 'NO' : 'YES')
    }

}

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

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')

    main()
})

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

const s2i = s => parseInt(s, 10)

const readLineOfBigInts = () => {
  const split = readLine().split(' ')
  const result = []
  for (let i = 0, l = split.length; i < l; i++) {
    result.push(BigInt(split[i]));
  }
  return result
}

const cmpi = (a, b) => a - b

function main() {
  let T = s2i(readLine())
  let out = ''

  while (T--) {
    const n = s2i(readLine())
    const a = readLine().split(' ').map(s2i)

    let result = 'YES'

    a.sort(cmpi)

    for (let i = 1; i < a.length; i++) {
      if (a[i] - a[i-1] > 1) {
        result = 'NO'
        break
      }
    }

    out += result + '\n'
  }

  console.log(out)
}

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

function main() {
	let t = +readLine();
	while (t--) {
		let n = +readLine();
		let arr = readLine()
			.split(' ')
			.map(x => parseInt(x));

		arr.sort((a, b) => a - b);
		let count = 0;

		for (let i = 0; i < n - 1; i++) {
			let diff = Math.abs(arr[i] - arr[i + 1]);
			if (diff > 1) {
				count++;
			}
		}

		if (count) {
			console.log('NO');
		} else {
			console.log('YES');
		}
	}
}

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

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let arr = readLine()
			.split(' ')
			.map(x => x >> 0);

		let possible = true;
		arr.sort((a, b) => a - b);

		for (let i = 1, l = arr.length; i < l; ++i) {
			let diff = arr[i] - arr[i - 1];
			if (diff > 1) {
				possible = false;
				break;
			}
		}

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

function compare(x, y) {
  return (x < y) ? (- 1) : ((x > y) ? 1 : 0);
}

const yes = 'YES';
const no = 'NO';

function solve(xs) {
  if (xs.length < 1) {
    throw Error('input is empty');
  } else if (xs.length < 2) {
    return yes;
  } else {
    xs.sort(compare);
    let max_diff = 0;
    for (let i = 1; i < xs.length; i = i + 1) {
      const a = xs[i - 1];
      const b = xs[i];
      const diff = b - a;
      max_diff = Math.max(max_diff, diff);
    }
    return (max_diff < 2) ? yes : no;
  }
}

function main(lines) {
  for (let i = 1; (i + 1) < lines.length; i = i + 2) {
    const line = lines[i + 1];
    const t = line.trim();
    if (t.length > 0) {
      const xs = t.split(/\s/).map(Number);
      const result = solve(xs);
      console.log(result)
    }
  }
}

async function processLinesFromStream(rs, pf) {
  const content = [];
  rs.setEncoding("utf-8");
  for await (let chunk of rs) {
    content.push(chunk);
  }
  const lines = content.join('').split(/\n/);
  const result = pf(lines);
  return result;
}

processLinesFromStream(process.stdin, main);

function compare(x, y) {
  return (x < y) ? (- 1) : ((x > y) ? 1 : 0);
}

const yes = 'YES';
const no = 'NO';

function solve(xs) {
  if (xs.length < 1) {
    throw Error('input is empty');
  } else if (xs.length < 2) {
    return yes;
  } else {
    xs.sort(compare);
    let max_diff = 0;
    for (let i = 1; i < xs.length; i = i + 1) {
      const a = xs[i - 1];
      const b = xs[i];
      const diff = b - a;
      max_diff = Math.max(max_diff, diff);
    }
    return (max_diff < 2) ? yes : no;
  }
}

function main(lines) {
  const whitespace = /\s+/;
  for (let i = 1; (i + 1) < lines.length; i = i + 2) {
    const line = lines[i + 1];
    const xs = line.split(whitespace).map(Number);
    const result = solve(xs);
    console.log(result)
  }
}

function trim_line(s) {
  return s.trim();
}

function has_content(s) {
  return (s.length > 0);
}

async function processLinesFromStream(rs, pf) {
  const chunks = [];
  const encoding = 'utf-8';
  rs.setEncoding(encoding);
  for await (let chunk of rs) {
    chunks.push(chunk);
  }
  const empty = '';
  const newline = /\n/;
  const lines = chunks.join(empty)
                      .split(newline)
                      .map(trim_line)
                      .filter(has_content);
  const result = pf(lines);
  return result;
}

processLinesFromStream(process.stdin, main);

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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

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

  for (let t = 0; t < N; ++t) {
    const b = readline();
    const arr = readline()
      .split(" ")
      .map((x) => parseInt(x));

    arr.sort((i, j) => i - j);

    let isYes = true;
    for (let k = 1; k < arr.length; ++k) {
      if (arr[k] - arr[k - 1] > 1) {
        print("NO\n");
        isYes = false;
        break;
      }
    }

    if (isYes) {
      print("YES\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();
    });

    main();
});

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

function main(){
    let t = parseInt(readline());
    for(let i = 0; i < t; i++){
        let n = parseInt(readline());
        let arr = readline().split(' ');
        arr.sort((a,b) => a-b);
        let flag = true;
        for(let j = 1; j < arr.length; j++){
            if(parseInt(arr[j])-parseInt(arr[j-1]) > 1){
                flag = false;
                console.log('NO');
                break;
            }
        }

        if(flag)
            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++];
}
/**
5
3
1 2 2
4
5 5 5 5
3
1 2 4
4
1 3 4 4
1
100
**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function lcm(a, b) {
    return (a / gcd(a, b) * b);
}

function main() {
    let n = Number(readline());

    for(let r=0;r<n;r++) {
        solve(r);
    }

}

function solve(index) {
    let n = Number(readline());
    let a = readline().split(" ").map(Number);

    a.sort((x, y) => x - y);
    if(a.length === 1) {
        console.log('YES');
        return;
    }

    for(let i=1;i<a.length;i++) {
        if(Math.abs(a[i] - a[i-1]) > 1) {
            console.log('NO');
            return;
        }
    }

    console.log('YES');

}

function solve() {
    var n = readInt()
    var arr = readIntArray().sort((a, b) => a - b)

    var prevNum = arr[0]
    var i
    for(i=1; i<n;i++) {
        if (arr[i] - prevNum > 1) {
            print("NO")
            return
        }
        prevNum = arr[i]
    }
    print("YES")
}

var testCases = readInt();
var testCaseNum;
for(testCaseNum=0; testCaseNum<testCases; testCaseNum++) {
  solve()
}

function readIntArray() {
    return readline().split(" ").map(function(x) { return parseInt(x); });
}

function readInt() {
    return parseInt(readline())
}

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++];
}
function main() {
  let t = +readLine();
  while (t--) {
    let len = +readLine();
    const arr = readLine()
      .split(" ")
      .map((n) => parseInt(n));

    arr.sort((a, b) => a - b);
    let count = 0;
    for (let i = 0; i < len - 1; i++) {
      if (Math.abs(arr[i] - arr[i + 1]) === 2) count++;
    }
    if (count) console.log("NO");
    else 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++];
}

function print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  // input
  let t = +readline();
  for (let i = 0; i < t; i++) {
    const n = +readline();
    const a = readline().split(' ').map(x => parseInt(x));
    let no = false;
    for (let j = 1; j < n; j++) {
      if (Math.abs(a[j] - a[j-1]) > 1) {
        print('NO\n');
        no = true;
        break;
      }
    }
    if (!no) {
      print('YES\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')

    main()
})

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

const s2i = s => parseInt(s, 10)

const readLineOfBigInts = () => {
  const split = readLine().split(' ')
  const result = []
  for (let i = 0, l = split.length; i < l; i++) {
    result.push(BigInt(split[i]));
  }
  return result
}

function main() {
  let T = s2i(readLine())
  let out = ''

  while (T--) {
    const n = s2i(readLine())
    const a = readLine().split(' ').map(s2i)

    let result = 'Yes'

    a.sort()

    for (let i = 1; i < a.length; i++) {
      if (a[i] - a[i-1] > 1) {
        result = 'NO'
        break
      }
    }

    out += result + '\n'
  }

  console.log(out)
}

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')

    main()
})

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

const s2i = s => parseInt(s, 10)

const readLineOfBigInts = () => {
  const split = readLine().split(' ')
  const result = []
  for (let i = 0, l = split.length; i < l; i++) {
    result.push(BigInt(split[i]));
  }
  return result
}

function main() {
  let T = s2i(readLine())
  let out = ''

  while (T--) {
    const n = s2i(readLine())
    const a = readLine().split(' ').map(s2i)

    let result = 'YES'

    a.sort()

    for (let i = 1; i < a.length; i++) {
      if (a[i] - a[i-1] > 1) {
        result = 'NO'
        break
      }
    }

    out += result + '\n'
  }

  console.log(out)
}

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

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let arr = readLine()
			.split(' ')
			.map(x => x >> 0);

		let possible = true;
		arr.sort();

		for (let i = 1; i < n; i++) {
			let diff = arr[i] - arr[i - 1];
			if (diff > 1) {
				possible = false;
			}
		}

		if (possible) {
			console.log('YES');
		} else {
			console.log('NO');
		}
	}
}

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

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let arr = readLine()
			.split(' ')
			.map(x => x >> 0);

		if (n === 1) {
			console.log('YES');
			return;
		}

		let possible = true;
		arr.sort();

		for (let i = 1; i < n; i++) {
			let diff = Math.abs(arr[i] - arr[i - 1]);
			if (diff > 1) {
				possible = false;
				break;
			}
		}

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

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

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let arr = readLine()
			.split(' ')
			.map(x => x >> 0);
		arr.sort();
		let flag = true;

		for (let i = 0; i < n - 1; i++) {
			if (Math.abs(arr[i] - arr[i + 1]) > 1) {
				flag = false;
				break;
			}
		}

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

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

function main() {
	let t = +readLine();
	while (t--) {
		let n = +readLine();
		let arr = readLine()
			.split(' ')
			.map(x => parseInt(x));

		let possible = true;
		arr.sort();

		for (let i = 1; i < n; i++) {
			let diff = arr[i] - arr[i - 1];
			if (diff > 1) {
				possible = false;
			}
		}

		if (possible) {
			console.log('YES');
		} else {
			console.log('NO');
		}
	}
}

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

function main() {
	let t = +readLine();
	while (t--) {
		let n = +readLine();
		let arr = readLine()
			.split(' ')
			.map(x => parseInt(x));

		arr.sort((a, b) => a - b);
		console.log(arr);
		let count = 0;

		for (let i = 0; i < n - 1; i++) {
			let diff = Math.abs(arr[i] - arr[i + 1]);
			if (diff > 1) {
				count++;
			}
		}

		if (count) {
			console.log('NO');
		} else {
			console.log('YES');
		}
	}
}

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

function main() {
	let t = +readLine();
	while (t--) {
		let n = +readLine();
		let arr = readLine()
			.split(' ')
			.map(x => parseInt(x));

		arr.sort();
		let count = 0;

		for (let i = 0; i < n - 1; i++) {
			let diff = Math.abs(arr[i] - arr[i + 1]);
			if (diff > 1) {
				count++;
			}
		}

		if (count) {
			console.log('NO');
		} else {
			console.log('YES');
		}
	}
}

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

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let arr = readLine()
			.split(' ')
			.map(x => x >> 0);

		let possible = true;
		arr.sort();

		for (let i = 1, l = arr.length; i < l; ++i) {
			let diff = arr[i] - arr[i - 1];
			if (diff > 1) {
				possible = false;
				break;
			}
		}

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

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

function main() {
	let t = readLine() >> 0;
	while (t--) {
		let n = readLine() >> 0;
		let arr = readLine()
			.split(' ')
			.map(x => x >> 0);

		if (n === 1) {
			console.log('YES');
			continue;
		}

		let possible = true;
		arr.sort();

		for (let i = 1; i < n; i++) {
			let diff = Math.abs(arr[i] - arr[i - 1]);
			if (diff > 1) {
				possible = false;
				break;
			}
		}

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

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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

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

  for (let i = 0; i < N; ++i) {
    const arr = readline()
      .split(" ")
      .map((x) => parseInt(x));

    arr.sort();

    const isYes = arr.every((x, i) => {
      if (i < 1) {
        return true;
      } else if (Math.abs(x - arr[i - 1]) <= 1) {
        return true;
      } else {
        return false;
      }
    });

    if (isYes) {
      print("YES");
    } else {
      print("NO");
    }
  }
}

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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

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

  for (let t = 0; t < N; ++t) {
    const b = readline();
    const arr = readline()
      .split(" ")
      .map((x) => parseInt(x));

    arr.sort();

    let isYes = true;
    for (let k = 1; k < arr.length; ++k) {
      if (arr[k] - arr[k - 1] > 1) {
        print("NO\n");
        isYes = false;
        break;
      }
    }

    if (isYes) {
      print("YES\n");
    }
  }
}

'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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

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

  for (let i = 0; i < N; ++i) {
    const arr = readline()
      .split(" ")
      .map((x) => parseInt(x));

    arr.sort();

    const isYes = arr.every((x, i) => {
      if (i < 1) {
        return true;
      } else if (Math.abs(x - arr[i - 1]) <= 1) {
        return true;
      } else {
        return false;
      }
    });

    if (isYes) {
      print("YES");
    } else {
      print("NO");
    }
  }
}

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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

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

  for (let t = 0; t < N; ++t) {
    const arr = readline()
      .split(" ")
      .map((x) => parseInt(x));

    arr.sort();

    const isYes = arr.every((x, i) => {
      if (i < 1) {
        return true;
      } else if (Math.abs(x - arr[i - 1]) <= 1) {
        return true;
      } else {
        return false;
      }
    });

    if (isYes) {
      print("YES");
    } else {
      print("NO");
    }
  }
}

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 print(s) {
  process.stdout.write(`${s}`);
}
// Make a Snippet for the code above this and then write your logic in main();

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

  for (let t = 0; t < N; ++t) {
    const b = readline();
    const arr = readline()
      .split(" ")
      .map((x) => parseInt(x));

    arr.sort();

    let isYes = true;
    for (let k = 1; k < arr.length; ++k) {
      if (arr[k] - arr[k - 1] > 1) {
        print("NO");
        isYes = false;
        break;
      }
    }

    if (isYes) {
      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++];
}
/**
5
3
1 2 2
4
5 5 5 5
3
1 2 4
4
1 3 4 4
1
100
**/

function gcd(a, b) {
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
};

function lcm(a, b) {
    return (a / gcd(a, b) * b);
}

function main() {
    let n = Number(readline());

    for(let r=0;r<n;r++) {
        solve(r);
    }

}

function solve(index) {
    let n = Number(readline());
    let a = readline().split(" ").map(Number);

    if(a.length === 1) {
        console.log('YES');
        return;
    }

    for(let i=1;i<a.length;i++) {
        if(Math.abs(a[i] - a[i-1]) > 1) {
            console.log('NO');
            return;
        }
    }

    console.log('YES');

}

function solve() {
    var n = readInt()
    var arr = readIntArray().map( x => x * 1).sort()

    var prevNum = arr[0]
    var i
    for(i=1; i<n;i++) {
        if (arr[i] - prevNum > 1) {
            print("NO")
            return
        }
        prevNum = arr[i]
    }
    print("YES")
}

var testCases = readInt();
var testCaseNum;
for(testCaseNum=0; testCaseNum<testCases; testCaseNum++) {
  solve()
}

function readIntArray() {
    return readline().split(" ").map(function(x) { return parseInt(x); });
}

function readInt() {
    return parseInt(readline())
}

function solve() {
    var n = readInt()
    var arr = readIntArray().sort()

    var prevNum = arr[0]
    var i
    for(i=1; i<n;i++) {
        if (arr[i] - prevNum > 1) {
            print("NO")
            return
        }
        prevNum = arr[i]
    }
    print("YES")
}

var testCases = readInt();
var testCaseNum;
for(testCaseNum=0; testCaseNum<testCases; testCaseNum++) {
  solve()
}

function readIntArray() {
    return readline().split(" ").map(function(x) { return parseInt(x); });
}

function readInt() {
    return parseInt(readline())
}


You have n distinct points on a plane, none of them lie on OY axis. Check that there is a point after removal of which the remaining points are located on one side of the OY axis.

The first line contains a single positive integer n (2 ≤ n ≤ 105). The following n lines contain coordinates of the points. The i-th of these lines contains two single integers xi and yi (|xi|, |yi| ≤ 109, xi ≠ 0). No two points coincide.

Print "Yes" if there is such a point, "No" — otherwise. You can print every letter in any case (upper or lower).

NoteIn the first example the second point can be removed.In the second example there is no suitable for the condition point.In the third example any point can be removed.

var N = parseInt( readline() );
var num1 = 0;
var num2 = 0;

for(var i=0;i<N;i++){
	var a = readline().split(" ");
	if(  parseInt(a[0]) < 0){
		num1 += 1;
	}else{
		num2 += 1;
	}
}

if( num1 <= 1 || num2 <= 1 ){
	print('Yes');
}else{
	print('No');
}

var n=readline();
n=parseInt(n);
var cordinate,x,y;
var positivex=0;
var negativex=0;

    for (var i=0;i<n;i++) {
       cordinate=readline().split(" ")
       x=parseInt(cordinate[0]);
       y=parseInt(cordinate[1]);
       if (x>0) {
          positivex += 1;
       } else {
         negativex += 1;

       }
    }

	if (positivex===1 || positivex===0) {
		write("Yes");
	} else if (negativex===1 || negativex===0) {
		write("Yes");
	} else {
		write("No");
	}

var num = parseInt(readline());
var xPos = 0;
var xNeg = 0;
var canBeDone = true;

for (var i = 0; i < num; i++) {
  var x = readline().split(' ').map(function(element) {
    return parseInt(element);
  })[0];

  if (x > 0) {
    xPos++;
  } else {
    xNeg++;
  }

  if (xPos > 1 && xNeg > 1) {
    canBeDone = false;
    print('No');
    break;
  }
}

if (canBeDone) {
  print('Yes');
}

var num = parseInt(readline());
var dev = 0;

for (var i = 0; i < num; i++) {
  var x = readline().split(' ').map(function(element) {
    return parseInt(element);
  })[0];

  if (x > 0) {
    dev++;
  } else {
    dev--;
  }
}

if (num - Math.abs(dev) <= 2) {
  print('Yes');
} else {
  print('No');
}

function toInt(x) {
	return parseInt(x);
}

var n = toInt(readline());
var x, plus = 0, minus = 0;

for (var i = 0; i < n; i++) {
	x = readline().split(" ").map(toInt);
	if (x[0] < 0) {
		minus++;
	} else {
		plus++;
	}
}

if (plus > 1 && minus > 1) {
	print("NO");
} else {
	print("YES");
}

var n = readline();
var positiveCount = 0;
var negativeCount = 0;
for (var i = 0; i < n; i++) {
    var point = parseInt(readline());
    if (point > 0) {
        positiveCount++;
    } else {
        negativeCount++;
    }
    if (positiveCount > 1 && negativeCount > 1) {
        print('No');
        break;
    }
}
if (positiveCount <= 1 || negativeCount <= 1) {
    print('Yes');
}

function main() {
  var n = readline();

  var numNeg = 0;
  var numPos = 0;

  for (var i = 0; i < n; i++) {
    var x = readline().split(' ')[0];

    if (x > 0) {
      numPos++;
    } else {
      numNeg++;
    }
  }

  print(numPos < 2 || numNeg < 2 ? 'Yes' : 'No');
}

main();

var n = Number(readline());
var min = 0, plu = 0;
for(var i = 0; i < n; i++){
    var c = readline().split(' ').map(Number);
    if(c[0] < 0)
        min++;
    else
        plu++;
}
if(min <=1 || plu <=1)
print("Yes");
else
print("No");

n=Number(readline())
var A=[]
for (var i=0;i<n;++i) A.push(Number(readline().split(' ')[0]))
var ne=A.reduce((a,v)=>a+(v<0),0)
print((!ne || ne===1 || ne===(n-1) || ne===n)?'Yes':'No')

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

var arr = ''
process.stdin.on('data', (i) => {
  arr += i
})

process.stdin.on('end', () => {
  arr = arr.split('\n')
  const n = parseInt(arr.shift())
  let xg = 0
  let xl = 0
  for(let i = 0; i < n; i ++) {
    const co = arr[i].split(' ')
    if(parseInt(co[0]) > 0) xg++
    else xl ++
  }
  if((xg <= 1 && xl >= 0) || (xl <= 1 && xg >= 0)) {
    console.log('Yes')
  }
  else {
    console.log('No')
  }

})

//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↑入力 ↓出力');
	Main();
});
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 L = 0;
  var R = 0;
  for(var i = 0; i < N; i++){
    var tmp = nextIntArray();
    if(tmp[0] < 0){
      L++;
    }else{
      R++;
    }
  }
  if(L > 1 && R > 1){
    myout("No");
  }else{
    myout("Yes");
  }
}

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

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

  const [x, y] = d.split(' ').map(Number);

  if (x > 0) {
    R++;
  }
  else {
    L++;
  }

  c++;
});

rl.on('close', () => {
  if (L <= 1 || R <= 1) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }
});

var num = parseInt(readline());
var dev = 0;

for (var i = 0; i < num; i++) {
  var x = readline().split(' ').map(function(element) {
    return parseInt(element);
  })[0];

  if (x > 0) {
    dev++;
  } else {
    dev--;
  }
}
print(dev);
if (num - Math.abs(dev) <= 2) {
  print('Yes');
} else {
  print('No');
}

function toInt(x) {
	return parseInt(x);
}

var n = toInt(readline());
var x, plus = 0, minus = 0;

for (var i = 0; i < n; i++) {
	x = readline().split(" ").map(toInt);
	if (x[0] < 0) {
		minus++;
	} else {
		plus++;
	}
}

if (Math.abs(plus-minus) < 2) {
	print("YES");
} else {
	print("NO");
}

function main() {
  var n = readline();

  var numNeg = 0;
  var numPos = 0;

  for (var i = 0; i < n; i++) {
    var y = readline().split(' ')[1];

    if (y > 0) {
      numPos++;
    } else {
      numNeg++;
    }
  }

  print(numPos < 2 || numNeg < 2 ? 'Yes' : 'No');
}

main();

var n=readline();
n=parseInt(n);
var cordinate,x,y;
var positivex=0;
var negativex=0;

    for (var i=0;i<n;i++) {
       cordinate=readline().split(" ")
       x=parseInt(cordinate[0]);
       y=parseInt(cordinate[1]);
       if (x>0) {
          positivex += 1;
       } else {
         negativex += 1;

       }
    }

	if (positivex===1) {
		write("Yes");
	} else if (negativex===1) {
		write("Yes");
	} else {
		write("No");
	}


You are given two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$). Represent the number $$$n$$$ as the sum of $$$k$$$ positive integers of the same parity (have the same remainder when divided by $$$2$$$).In other words, find $$$a_1, a_2, \ldots, a_k$$$ such that all $$$a_i>0$$$, $$$n = a_1 + a_2 + \ldots + a_k$$$ and either all $$$a_i$$$ are even or all $$$a_i$$$ are odd at the same time.If such a representation does not exist, then report it.

The first line contains an integer $$$t$$$ ($$$1 \le t \le 1000$$$) — the number of test cases in the input. Next, $$$t$$$ test cases are given, one per line. Each test case is two positive integers $$$n$$$ ($$$1 \le n \le 10^9$$$) and $$$k$$$ ($$$1 \le k \le 100$$$).

For each test case print:   YES and the required values $$$a_i$$$, if the answer exists (if there are several answers, print any of them);  NO if the answer does not exist.  The letters in the words YES and NO can be printed in any case.

'use strict';

const parseProblem = (line, problem) => {
    if (!problem.T || problem.T === 0) {
        const result = {problem,
            T: parseInt(line),
            isProcessing: true,
            cases: []
        };
        return result;
    }

    const cases = problem.cases;

    if (cases.length === 0 || !cases[cases.length - 1].isProcessing) {
        cases.push({
            t: line
        });
    }

    const isProcessing = cases.length < problem.T;
    problem.isProcessing = isProcessing;

    return problem;
};

const solve = data => {
    const [n, k] = data.t.split(' ');
    let result = [];

    const v1 = n - (k - 1);
    const v2 = n - 2 * (k - 1);

    if(v1 > 0 && v1 % 2 == 1) {
        for(let i = 0; i < k - 1; i++) {
            result.push(1);
        }
        result.push(v1);
    } else if (v2 > 0 && v2 % 2 == 0) {
        for(let i = 0; i < k - 1; i++) {
            result.push(2);
        }
        result.push(v2);
    }

    return result;
}

const solveCases = cases => {
    for (let index = 0; index < cases.length; index++) {
        const result = solve(cases[index]);
        console.log((result.length) ? ('YES' + '\n' + result.join(' ')) : 'NO');
    }
};

const main = () => {
    const readline = require('readline');

    let problem = {
        T: 0,
        cases: [],
        isProcessing: true
    };

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

    rl.on('line', line => {
        problem = parseProblem(line, problem);

        if (!problem.isProcessing) {
            rl.close();
        }
    }).on('close', () => {
        solveCases(problem.cases);
        process.exit(0);
    });
};

if (!module.parent) {
    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(str => str.trim());

    main();
});

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

function main() {
    const t = parseInt(readLine(), 10);
    for (let j = 0;j<t;j++){
        let [n,k] = readLine().split(' ').map(x=>parseInt(x));
        if (k % 2 == 0 && n % 2 != 0) {
            console.log('NO')
            continue;
        }

        let solution = [];
        let odd = k % 2 == 0 || n % 2 != 0;
        let sum = 0;

        for (let i = 0; i<k  - 1; i++) {
            solution.push(odd ? 1 : 2);
            sum += solution[i];
        }

        if (n <= sum) {
            console.log("NO")
            continue;
        }

        solution.push(n - sum);
        console.log("YES")
        console.log(solution.join(" "))
    }

}

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);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
});
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){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
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;}}
function Main(){
        var t = nextInt();
	var output = [];
	for(var i = 0; i < t; i++){
		var one = nextIntArray();
		var N = one[0];
		var K = one[1];
		if(N % K == 0){
			output.push("YES");
			var list = new Array(K);
			for(var j = 0; j < K; j++){
				list[j] = N / K;
			}
			output.push(myconv(list,8));
			continue;
		}
		if(N < K){
			output.push("NO");
			continue;
		}

		if((N - (K - 1)) % 2 == 1){
			output.push("YES");
			var list = new Array(K);
			list.fill(1);
			list[K - 1] = N - (K - 1);
			output.push(myconv(list,8));
			continue;
		}

		if((N - (K - 1) * 2) > 0 && (N - (K - 1) * 2) % 2 == 0){
			output.push("YES");
			var list = new Array(K);
			list.fill(2);
			list[K - 1] = N - (K - 1) * 2;
			output.push(myconv(list,8));
			continue;
		}
		output.push("NO");

	}
	myout(myconv(output,9));
}

"use strict";
var __spreadArrays = (this && this.__spreadArrays) || function () {
    for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
    for (var r = Array(s), k = 0, i = 0; i < il; i++)
        for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
            r[k] = a[j];
    return r;
};
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(" ").map(function (e) { return parseInt(e); }), n = _a[0], k = _a[1];
        var a = n - (k - 1);
        var b = n - (k - 1) * 2;
        var x = [];
        if (a > 0 && a % 2 != 0) {
            x = __spreadArrays([a], (Array(k - 1).fill(1)));
        }
        else if (b > 0 && b % 2 == 0) {
            x = __spreadArrays([b], (Array(k - 1).fill(2)));
        }
        if (x.length) {
            print("YES");
            print(x.join(" "));
        }
        else {
            print("NO");
        }
    }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL);

    function foo (num, col) {
        let body = col - 1;
        let rest = num - body;
        let arr = [];

        if (rest <= 0) return ['NO'];
        if (rest%2 === 1) {
            arr = Array(body).fill(1);
            arr.push(rest);
            return ['YES', arr.join(' ')];
        }

        body = 2 * (col - 1);
        rest = num - body;

        if (rest <= 0) return ['NO'];
        if (rest%2 === 0) {
            arr = Array(body/2).fill(2);
            arr.push(rest);
            return ['YES', arr.join(' ')]
        }

        return ['NO'];
    }

    let testCount = 1;
    let answer = '';
    while(testCount <= +lines[0]) {
        let data = lines[testCount].split(" ").map(Number);
        let result = foo(data[0], data[1]);
        answer += result[0] +"\n";
        if (result[1]) answer += result[1] +"\n";
        testCount++;
    }
    console.log(answer);
})

const processData = (lines) => {
  const n = +lines[0]
  for (let i=0; i<n; i++) {
    let [a, k] = lines[i+1].split(' ').map(x => +x)

    if (a%2 === 1 && k%2 === 1) {
      if (k > a) {
        console.log('NO')
      } else {
        console.log('YES')
        const res = Array(k).fill(1)
        res[0] = a-k+1
        console.log(res.join(' '))
      }
    } else {
      if (a%2 === 1 && k%2 === 0) {
        console.log('NO')
      } else {
        if (k%2 === 0) {
          if (k>a) {
            console.log('NO')
          } else {
            console.log('YES')
            const res = Array(k).fill(1)
            res[0] = a-k+1
            console.log(res.join(' '))
          }
        } else {
          const min = k*2
          if (min > a) {
            console.log('NO')
          } else {
            console.log('YES')
            const res = Array(k).fill(2)
            res[0] = a-k*2+2
            console.log(res.join(' '))
          }
        }
      }
    }
  }
}

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

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

// your code goes here

// declare global variables
var input_stdin = "";
var noOfTestcase = 0;

// standard input is stored into input_stdin
process.stdin.on('data', function (data) {
    input_stdin += data;
});

// standard input is done and stored into an array
process.stdin.on('end', function () {
    chunks = input_stdin.split("\n");
    noOfTestcase = chunks[0];
    process.stdout.write('\n');
    for(let i=1; i < chunks.length; i++){
      let row = chunks[i].split(" ");
      if(isNaN(row[0]) || isNaN(row[1])){
        // do nothing
      }else{
        start(Number(row[0]), Number(row[1]));
      }
    }
});

function isEven(val){
  if(val%2 == 0){
    return true
  }
  return false
}

function start(sum,K){
  // console.log("sum = ",sum, " K=",K);
  let eS = isEven(sum);
  let eK = isEven(K);
  // console.log("eS = ",eS, " eK=",eK);
  if(sum < K ){
    // console.log("less than");
    process.stdout.write("NO"+ '\n');
  }else if (!eS && eK) {
    // console.log("odd - even condition");
    process.stdout.write("NO"+ '\n');
  }else if (eS && !eK && sum < (2*K)) {
    // console.log("even - odd but twice condition");
    process.stdout.write("NO"+ '\n');
  }else {
    process.stdout.write("YES"+ '\n');
    let str = ""
    if(!eS){
      for(let k=1; k < K; k++){
        str +="1 "
      }
      str+=(sum-K+1)
    }else{
      if(!eK){
        for(let k=1; k < K; k++){
          str +="2 "
        }
        str+=(sum-(2*K)+2)
      }else{
        for(let k=1; k < K; k++){
          str +="1 "
        }
        str+=(sum-K+1)
      }
    }
    process.stdout.write(str+ '\n');
  }
  return;
}

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

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

function solve(n, k) {
  let res = [];
  let total = 0;
  let base = 1;
  for (let i = 1; i <= k; i++) {
    if (i === k) {
      let last = n - total;
      if (last > 0 && last % 2 === 1) {
        res.push(last);
        return res;
      }
    }
    res.push(base);
    total += base;
  }
  res = [];
  total = 0;
  base = 2;
  for (let i = 1; i <= k; i++) {
    if (i === k) {
      let last = n - total;
      if (last > 0 && last % 2 === 0) {
        res.push(last);
        return res;
      }
    }
    res.push(base);
    total += base;
  }
  return 0;
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let [n, k] = readLine().split(' ').map((val) => parseInt(val));
    // let a = readLine().split(' ').map((val) => parseInt(val));
    let res = solve(n, k);
    if (res.length > 0) console.log('YES', res.join(' '));
    else console.log('NO');
  }
  //process.stdout.write("hello: ");
}

"use strict";

var ans ="";

function hasEven(x1 , x2){

	ans ="";

	var eq1 =(x2 -1) *2;
	var eq2 =x1 -eq1;

	if(eq2 >0 && !(eq2 &1) && eq1 +eq2 ==x1){

        x2 --;
        while(x2 --) ans +=" " +'2';
        ans +=" " +eq2.toString();

        return "YES";

    }
    return "NO";

}

function hasOdd(x1 , x2){

	ans ="";

	var eq1 =(x2 -1);
	var eq2 =x1 -eq1;

	if(eq2 >0 && (eq2 &1) && eq1 +eq2 ==x1){

        x2 --;
        while(x2 --) ans +=" " +'1';
        ans +=" " +eq2.toString();

        return "YES";

    }
    return "NO";

}

var cases =parseInt(readline());

while(cases --){

	ans ="";
	var read =readline().split(" ");
	var n =parseInt(read[0]);
	var k =parseInt(read[1]);

	if(k <=n && hasEven(n , k) =="YES"){

		print("YES");
		print(ans.trim());

	}else if(k <=n && hasOdd(n , k) =="YES"){

		print("YES");
		print(ans.trim());

	}else{
		print("NO");
	}

}

var ans ="";

function hasEven(x1 , x2){

	ans ="";

	var eq1 =(x2 -1) *2;
	var eq2 =x1 -eq1;

	if(eq2 >0 && !(eq2 &1) && eq1 +eq2 ==x1){

        x2 --;
        while(x2 --) ans +=" " +'2';
        ans +=" " +eq2.toString();

        return "YES";

    }
    return "NO";

}

function hasOdd(x1 , x2){

	ans ="";

	var eq1 =(x2 -1);
	var eq2 =x1 -eq1;

	if(eq2 >0 && (eq2 &1) && eq1 +eq2 ==x1){

        x2 --;
        while(x2 --) ans +=" " +'1';
        ans +=" " +eq2.toString();

        return "YES";

    }
    return "NO";

}

var cases =parseInt(readline());

while(cases --){

	ans ="";
	var read =readline().split(" ");
	var n =parseInt(read[0] , 10);
	var k =parseInt(read[1] , 10);

	if(k <=n && hasEven(n , k) =="YES"){

		print("YES");
		print(ans.trim());

	}else if(k <=n && hasOdd(n , k) =="YES"){

		print("YES");
		print(ans.trim());

	}else{
		print("NO");
	}

}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var nk = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = nk[0],
    k = nk[1];
  var res = "";
  var flag = false;
  if (n % k == 0) {
    for (var j = 0; j < k; j++) {
      res += " " + n / k;
      flag = true;
    }
  } else if (n - k + 1 < 2) res = "No";
  else {
    if (n % 2 == 0) {
      if (k % 2 == 0) {
        res += n - k + 1;
        for (var i = 0; i < k - 1; i++) res += " " + 1;
        flag = true;
      } else {
        if (n - 2 * (k - 1) >= 4) {
          res += n - 2 * (k - 1);
          for (var i = 0; i < k - 1; i++) res += " " + 2;
          flag = true;
        } else res = "No";
      }
    } else {
      if (k % 2 == 0) {
        res = "No";
      } else {
        res += n - k + 1;
        for (var i = 0; i < k - 1; i++) res += " " + 1;
        flag = true;
      }
    }
  }
  if (flag) {
    print("Yes");
    print(res.trim());
  } else print(res.trim());
}

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var nk = readline().split(" ").map(Number);
    var n = nk[0];
    var k = nk[1];

    var nk1 = n - k + 1;
    var arr = new Array(k - 1).fill(1);
    if (nk1 % 2 === 1 && nk1 > 0) {
      arr.push(nk1);
      print("YES");
      print(arr.join(" "));
      continue;
    }

    var nk2 = n - (k - 1) * 2;
    var arr2 = new Array(k - 1).fill(2);
    if (nk2 % 2 === 0 && nk2 > 0) {
      arr2.push(nk2);
      print("YES");
      print(arr2.join(" "));
      continue;
    }
    print("NO");
  }
}

main();

'use strict';

let t = parseInt(readline(), 10);

while (t--) {
    const parts = readline().split(' ');
    let n = parseInt(parts[0], 10);
    let k = parseInt(parts[1], 10);

    function helper(N, K, result, sub) {
        const mod = sub % 2;
        while (N > 0 && K > 0) {
            if (N % K === 0 && N / K % 2 === mod) {
                const div = N / K;
                N -= div;
                K -= 1;
                result.push(div);
            } else {
                N -= sub;
                K -= 1;
                result.push(sub);
            }
        }
        return {N, K, result};
    }

    const resultOdd = helper(n, k, [], 1);
    const resultEven = helper(n, k, [], 2);

    if (resultOdd.N === 0 && resultOdd.K === 0) {
        print('YES');
        print(resultOdd.result.join(' '));
    } else if (resultEven.N === 0 && resultEven.K === 0) {
        print('YES');
        print(resultEven.result.join(' '));
    } else {
        print('NO');
    }
}

'use strict';

let t = parseInt(readline(), 10);

while (t--) {
    const parts = readline().split(' ');
    let n = parseInt(parts[0], 10);
    let k = parseInt(parts[1], 10);

    function helper(N, K, result, sub) {
        while (K > 1) {
            N -= sub;
            K -= 1;
            result.push(sub);
        }
        if (N <= 0 || N % 2 !== sub % 2) {
            return null;
        }
        result.push(N);
        return result;
    }

    const resultOdd = helper(n, k, [], 1);
    const resultEven = helper(n, k, [], 2);

    if (resultOdd) {
        print('YES');
        print(resultOdd.join(' '));
    } else if (resultEven) {
        print('YES');
        print(resultEven.join(' '));
    } else {
        print('NO');
    }
}

'use strict';

let t = parseInt(readline(), 10);

while (t--) {
    const parts = readline().split(' ');
    let n = parseInt(parts[0], 10);
    let k = parseInt(parts[1], 10);

    if (k > n) {
        print('NO');
        continue;
    }

    function helper(N, K, result, subs) {
        while (N > 0 && K > 0) {
            if (
                N % K === 0 &&
                (N / K) % 2 === (subs === 2 ? 0 : 1)
            ) {
                const div = N / K;
                N -= div;
                K -= 1;
                result.push(div);
            } else {
                N -= subs;
                K -= 1;
                result.push(subs);
            }
        }
        return {N, K, result};
    }

    const resultOdd = helper(n, k, [], 1);
    const resultEven = helper(n, k, [], 2);

    if (resultOdd.N === 0 && resultOdd.K === 0) {
        print('YES');
        print(resultOdd.result.join(' '));
    } else if (resultEven.N === 0 && resultEven.K === 0) {
        print('YES');
        print(resultEven.result.join(' '));
    } else {
        print('NO');
    }
}

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

var input  = []
rl.on('line', function(line){
    input.push(line);
})

rl.on("close", ContestResponse);

function ContestResponse(){
    let index = 0;
    var nCases = parseInt(input[index++]);
    for (let i = 0; i < nCases; i++){

      var line = input[index++].split(" ");
      var n = parseInt(line[0]);
      var k = parseInt(line[1]);

      var str = '';

      if (n % 2 === 0 && (n - ((k - 1) * 2)) % 2 === 0 && n - ((k - 1) * 2) > 0){
        console.log("YES");
        for (var j = 0; j < k - 1; j++){
          str += "2 ";
        }
        str += ""+ (n - ((k - 1) * 2));
      }
      else if ((n - (k - 1)) % 2 !== 0 && (n - (k - 1)) % 2 > 0){
        console.log('YES');
        for (var j = 0; j < k - 1; j++){
          str += '1 ';
        }
        str += '' + (n - (k - 1));
      }
      else{
        console.log('NO');
        continue;
      }
      console.log(str);
    }
}

'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++];
}
/**
  8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n , k] = readline().split(" ").map(Number);

        if( n% 2 !== 0 && k % 2 === 0) {
            console.log('NO');
            continue;
        }

        let odd = n % 2 === 0 && k % 2 !== 0;
        let count = 0;
        let output = [];

        for(let i=0;i<k-1;i++) {
            output.push(odd ? 2: 1);
            count += odd ? 2 : 1;
        }

        if(count >= n) {
            console.log('NO');
            continue;
        }

        output.push(n - count);
        console.log('YES');
        console.log(output.join(" "));
    }

}

'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() {

    let cases = parseInt(readline(), 10);
    for (var X = 0; X < cases; X++) {
      const [n,k] = readline().split(" ").map(e => parseInt(e));
      let result = new Array(k);

      let pairity = (k % 2) != (n %2) ? 0 : 1;
      if (pairity === 0) {
        result.fill(2);
        let first = n - ((k-1) * 2);
        if (first % 2 != 0 || first <= 0) {
          console.log('NO');
          continue;
        }
        result[0] = first;
      } else {
        result.fill(1);
        let first = n - (k-1);
        if (first % 2 != 1 || first <= 0) {
          console.log('NO');
          continue;
        }
        result[0] = first;
      }

      console.log('YES');
      console.log(result.join(' '))

    }

}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL);

    function foo (num, col) {
        let body = col - 1;
        let rest = num - body;

        if (rest < 0) return ['NO'];
        if (rest%2 === 1) {
            return ['YES', `${Array(body).fill(1).join(' ')} ${rest}`];
        }

        body = 2 * (col - 1);
        rest = num - body;

        if (rest < 0) return ['NO'];
        if (rest%2 === 0) {
            return ['YES', `${Array(body/2).fill(2).join(' ')} ${rest}`]
        }

        return ['NO'];
    }

    let testCount = 1;
    let answer = '';
    while(testCount <= +lines[0]) {
        let data = lines[testCount].split(" ").map(Number);
        let result = foo(data[0], data[1]);
        answer += result[0] +"\n";
        if (result[1]) answer += result[1] +"\n";
        testCount++;
    }
    console.log(answer);
})

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL);

    function foo (num, col) {
        let body = col - 1;
        let rest = num - body;
        let arr = [];

        if (rest < 0) return ['NO'];
        if (rest%2 === 1) {
            arr = Array(body).fill(1);
            arr.push(rest);
            return ['YES', arr.join(' ')];
        }

        body = 2 * (col - 1);
        rest = num - body;

        if (rest < 0) return ['NO'];
        if (rest%2 === 0) {
            arr = Array(body/2).fill(2);
            arr.push(rest);
            return ['YES', arr.join(' ')]
        }

        return ['NO'];
    }

    let testCount = 1;
    let answer = '';
    while(testCount <= +lines[0]) {
        let data = lines[testCount].split(" ").map(Number);
        let result = foo(data[0], data[1]);
        answer += result[0] +"\n";
        if (result[1]) answer += result[1] +"\n";
        testCount++;
    }
    console.log(answer);
})

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

// your code goes here

// declare global variables
var input_stdin = "";
var noOfTestcase = 0;

// standard input is stored into input_stdin
process.stdin.on('data', function (data) {
    input_stdin += data;
});

// standard input is done and stored into an array
process.stdin.on('end', function () {
    chunks = input_stdin.split("\n");
    noOfTestcase = chunks[0];
    process.stdout.write('\n');
    for(let i=1; i < chunks.length; i++){
      let row = chunks[i].split(" ");
      start(Number(row[0]), Number(row[1]));
    }
});

function isEven(val){
  if(val%2 == 0){
    return true
  }
  return false
}

function start(sum,K){
  // console.log("sum = ",sum, " K=",K);
  let eS = isEven(sum);
  let eK = isEven(K);
  // console.log("eS = ",eS, " eK=",eK);
  if(sum < K ){
    // console.log("less than");
    process.stdout.write("NO"+ '\n');
  }else if (!eS && eK) {
    // console.log("odd - even condition");
    process.stdout.write("NO"+ '\n');
  }else if (eS && !eK && sum < (2*K)) {
    // console.log("even - odd but twice condition");
    process.stdout.write("NO"+ '\n');
  }else {
    process.stdout.write("YES"+ '\n');
    let str = ""
    if(!eS){
      for(let k=1; k < K; k++){
        str +="1 "
      }
      str+=(sum-K+1)
    }else{
      if(!eK){
        for(let k=1; k < K; k++){
          str +="2 "
        }
        str+=(sum-(2*K)+2)
      }else{
        for(let k=1; k < K; k++){
          str +="1 "
        }
        str+=(sum-K+1)
      }
    }
    process.stdout.write(str+ '\n');
  }
  return;
}

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

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

function solve(n, k) {
  let res = [];
  let base = n % 2 === 0 ? Math.ceil(n / k) : Math.floor(n / k);
  if (base === 0) return 0;
  let total = 0;
  for (let i = 1; i <= k; i++) {
    if (i === k) {
      let last = n - total;
      if ((last <= 0) || last % 2 !== base % 2) return 0;
      res.push(last);
      return res;
    }
    res.push(base);
    total += base;
  }
  return res;
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let [n, k] = readLine().split(' ').map((val) => parseInt(val));
    // let a = readLine().split(' ').map((val) => parseInt(val));
    let res = solve(n, k);
    if (res.length > 0) console.log('YES', res.join(' '));
    else console.log('NO');
  }
  //process.stdout.write("hello: ");
}

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

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

function solve(n, k) {
  let res = [];
  let base = n % 2 === 0 ? Math.ceil(n / k) : Math.floor(n / k);
  let total = 0;
  for (let i = 1; i <= k; i++) {
    if (i === k) {
      let last = n - total;
      if ((last <= 0) || last % 2 !== base % 2) return 0;
      res.push(last);
      return res;
    }
    res.push(base);
    total += base;
  }
  return res;
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let [n, k] = readLine().split(' ').map((val) => parseInt(val));
    // let a = readLine().split(' ').map((val) => parseInt(val));
    let res = solve(n, k);
    if (res.length > 0) console.log('YES', res.join(' '));
    else console.log('NO');
  }
  //process.stdout.write("hello: ");
}

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

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

function solve(n, k) {
  if ((n % 2 === 1 && k % 2 === 0) || k > n) return 0;
  let res = [];
  let base = n % 2 === 0 ? Math.ceil(n / k) : Math.floor(n / k);
  let total = 0;
  for (let i = 1; i <= k; i++) {
    if (i === k) {
      let last = n - total;
      if ((last < 0) || last % 2 !== base % 2) return 0;
      res.push(last);
      break;
    }
    res.push(base);
    total += base;
  }
  return res;
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let [n, k] = readLine().split(' ').map((val) => parseInt(val));
    // let a = readLine().split(' ').map((val) => parseInt(val));
    let res = solve(n, k);
    if (res.length > 0) console.log('YES', res.join(' '));
    else console.log('NO');
  }
  //process.stdout.write("hello: ");
}

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

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

function solve(n, k) {
  let res = [];
  let base = n % 2 === 0 ? Math.ceil(n / k) : Math.floor(n / k);
  let total = 0;
  for (let i = 1; i <= k; i++) {
    if (i === k) {
      let last = n - total;
      if ((last < 0) || last % 2 !== base % 2) return 0;
      res.push(last);
      return res;
    }
    res.push(base);
    total += base;
  }
  return res;
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let [n, k] = readLine().split(' ').map((val) => parseInt(val));
    // let a = readLine().split(' ').map((val) => parseInt(val));
    let res = solve(n, k);
    if (res.length > 0) console.log('YES', res.join(' '));
    else console.log('NO');
  }
  //process.stdout.write("hello: ");
}

var ans ="";

function hasEven(x1 , x2){

	ans ="";

	var eq1 =(x2 -1) *2;
	var eq2 =x1 -eq1;

	if(eq2 >0 && !(eq2 &1) && eq1 +eq2 ==x1){

        x2 --;
        while(x2 --) ans +=" " +'2';
        ans +=" " +eq2.toString();

        return "YES";

    }
    return "NO";

}

function hasOdd(x1 , x2){

	ans ="";

	var eq1 =(x2 -1);
	var eq2 =x1 -eq1;

	if(eq2 >0 && (eq2 &1) && eq1 +eq2 ==x1){

        x2 --;
        while(x2 --) ans +=" " +'1';
        ans +=" " +eq2.toString();

        return "YES";

    }
    return "NO";

}

var cases =parseInt(readline());

while(cases --){

	ans ="";
	var read =readline().split(" ");
	var n =parseInt(read[0] , 12);
	var k =parseInt(read[1] , 12);

	if(k <=n && hasEven(n , k) =="YES"){

		print("YES");
		print(ans.trim());

	}else if(k <=n && hasOdd(n , k) =="YES"){

		print("YES");
		print(ans.trim());

	}else{
		print("NO");
	}

}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var nk = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = nk[0],
    k = nk[1];
  var res = "";
  var flag = false;
  if (n % k == 0) {
    for (var j = 0; j < k; j++) {
      res += " " + n / k;
      flag = true;
    }
  } else if (n - k + 1 < k) res = "No";
  else {
    if (n % 2 == 0) {
      if (k % 2 == 0) {
        res += n - k + 1;
        for (var i = 0; i < k - 1; i++) res += " " + 1;
        flag = true;
      } else {
        res += n - 2 * (k - 1);
        for (var i = 0; i < k - 1; i++) res += " " + 2;
        flag = true;
      }
    } else {
      if (k % 2 == 0) {
        res = "No";
      } else {
        res += n - k + 1;
        for (var i = 0; i < k - 1; i++) res += " " + 1;
        flag = true;
      }
    }
  }
  if (flag) {
    print("Yes");
    print(res.trim());
  } else print(res.trim());
}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var nk = readline()
    .split(" ")
    .map((val) => parseInt(val));
  var n = nk[0],
    k = nk[1];
  var res = "";
  var flag = false;
  if (n % k == 0) {
    for (var j = 0; j < 2; j++) {
      res += " " + n / k;
      flag = true;
    }
  } else if (n - k + 1 < k) res = "No";
  else {
    if (n % 2 == 0) {
      if (k % 2 == 0) {
        res += n - k + 1;
        for (var i = 0; i < k - 1; i++) res += " " + 1;
        flag = true;
      } else {
        if (n - 2 * (k - 1) >= 4) {
          res += n - 2 * (k - 1);
          for (var i = 0; i < k - 1; i++) res += " " + 2;
          flag = true;
        } else res = "No";
      }
    } else {
      if (k % 2 == 0) {
        res = "No";
      } else {
        res += n - k + 1;
        for (var i = 0; i < k - 1; i++) res += " " + 1;
        flag = true;
      }
    }
  }
  if (flag) {
    print("Yes");
    print(res.trim());
  } else print(res.trim());
}

'use strict';

let t = parseInt(readline(), 10);

while (t--) {
    const result = [];
    const parts = readline().split(' ');
    let n = parseInt(parts[0], 10);
    let k = parseInt(parts[1], 10);

    if (k === 1) {
        result.push(n);
        print('YES');
        print(result.join(' '));
        continue;
    }

    if (k > n) {
        print('NO');
        continue;
    }

    if (k === n) {
        for (let i = 0; i < k; i++) {
            result.push(1);
        }
        print('YES');
        print(result.join(' '));
        continue;
    }

    let chooseEven = n % 2 === 0;

    while (n > 0 && k > 0) {
        if (n % k === 0) {
            const div = n / k;
            if ((chooseEven && div % 2 === 0) || (!chooseEven && div % 2 !== 0)) {
                result.push(div);
                n -= div;
                k -= 1;
                continue;
            }
        }

        if (chooseEven) {
            result.push(2);
            n -= 2;
        } else {
            result.push(1);
            n -= 1;
        }
        k -= 1;
    }

    if (n === 0 && k === 0) {
        print('YES');
        print(result.join(' '));
    } else {
        print('NO');
    }
}

'use strict';

let t = parseInt(readline(), 10);

while (t--) {
    const parts = readline().split(' ');
    let n = parseInt(parts[0], 10);
    let k = parseInt(parts[1], 10);

    function helper(N, K, result, sub) {
        while (N > 0 && K > 1) {
            N -= sub;
            K -= 1;
            result.push(sub);
        }
        if (N % 2 === sub % 2) {
            result.push(N);
            K -= 1;
        }
        return {K, result};
    }

    const resultOdd = helper(n, k, [], 1);
    const resultEven = helper(n, k, [], 2);

    if (resultOdd.K === 0) {
        print('YES');
        print(resultOdd.result.join(' '));
    } else if (resultEven.K === 0) {
        print('YES');
        print(resultEven.result.join(' '));
    } else {
        print('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++];
}
/**
  8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n, index] = readline().split(" ").map(Number);

        if( n < index || n - 1 === index ) {
            console.log("NO");
            continue;
        }

        let output = [];
        let total = 0;

        if(index % 2 === 0) {
            if(n % 2 === 0) {
                for(let i=0;i<index - 1;i++) {
                    output.push(1);
                    total = total + 1;
                }

                output.push(n - total);
            } else {
                console.log("NO");
                continue;
            }
        } else {
            if(n % 2 === 0) {
                for(let i=0;i<index - 1;i++) {
                    output.push(2);
                    total = total + 2;
                }

                output.push(n - total);
            } else {
                for(let i=0;i<index - 1;i++) {
                    output.push(1   );
                    total = total + 1;
                }

                output.push(n - total);
            }
        }

        console.log("YES");
        console.log(output.join(" "));
    }

}

'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++];
}
/**
  8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n , k] = readline().split(" ").map(Number);

        if(n < k || n - 1 === k) {
            console.log('NO');
            continue;
        }

        if( n % 2 === 0) {
            if( k % 2 === 0) {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(1);
                    count++;
                }

                if(count >= n) {
                    console.log('NO');
                    continue;
                }

                output.push(n - count);

                console.log('YES');
                console.log(output.join(" "));
                continue;
            } else {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(2);
                    count = count + 2;
                }

                if(count >= n) {
                    console.log('NO');
                    continue;
                }
                output.push(n - count);
                console.log('YES');
                console.log(output.join(" "));
                continue;
            }
        } else {
            if(k % 2 !== 0) {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(1);
                    count++;
                }

                output.push(n - count);
                if(count >= n) {
                    console.log('NO');
                    continue;
                }
                console.log('YES');
                console.log(output.join(" "));
                continue;
            } else {
                console.log('NO');
                continue;
            }
        }

    }

}

'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++];
}
/**
  8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n, index] = readline().split(" ").map(Number);

        if( n < index || n - 1 === index ) {
            console.log("NO");
            continue;
        }

        let output = [];
        let total = 0;

        if(Math.abs(index) % 2 === 0) {
            if(Math.abs(n) % 2 === 0) {
                for(let i=0;i<index - 1;i++) {
                    output.push(1);
                    total = total + 1;
                }

                output.push(n - total);
            } else {
                console.log("NO");
                continue;
            }
        } else {
            if(Math.abs(n) % 2 === 0) {
                for(let i=0;i<index - 1;i++) {
                    output.push(2);
                    total = total + 2;
                }

                output.push(n - total);
            } else {
                for(let i=0;i<index - 1;i++) {
                    output.push(1   );
                    total = total + 1;
                }

                output.push(n - total);
            }
        }

        console.log("YES");
        console.log(output.join(" "));
    }

}

'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++];
}
/**
  8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n , k] = readline().split(" ").map(Number);

        if(n < k || n - 1 === k) {
            console.log('NO');
            continue;
        }

        if( n % 2 === 0) {
            if( k % 2 === 0) {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(1);
                    count++;
                }

                output.push(n - count);
                console.log('YES');
                console.log(output.join(" "));
                continue;
            } else {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(2);
                    count = count + 2;
                }

                output.push(n - count);
                console.log('YES');
                console.log(output.join(" "));
                continue;
            }
        } else {
            if(k % 2 !== 0) {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(1);
                    count++;
                }

                output.push(n - count);
                console.log('YES');
                console.log(output.join(" "));
                continue;
            } else {
                console.log('NO');
                continue;
            }
        }

    }

}

'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++];
}
/**
  8
10 3
100 4
8 7
97 2
8 8
3 10
5 3
1000000000 9

**/

function main() {
    let range = readline();

    for(let r=0;r<range;r++) {
        let [n , k] = readline().split(" ").map(Number);

        if(n < k || n - 1 === k) {
            console.log('NO');
            continue;
        }

        if( n % 2 === 0) {
            if( k % 2 === 0) {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(1);
                    count++;
                }

                if(count <= n) {
                    console.log('NO');
                    continue;
                }

                output.push(n - count);

                console.log('YES');
                console.log(output.join(" "));
                continue;
            } else {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(2);
                    count = count + 2;
                }

                if(count <= n) {
                    console.log('NO');
                    continue;
                }
                output.push(n - count);
                console.log('YES');
                console.log(output.join(" "));
                continue;
            }
        } else {
            if(k % 2 !== 0) {
                let output = [];
                let count = 0;

                for(let i=0;i<k-1;i++) {
                    output.push(1);
                    count++;
                }

                output.push(n - count);
                if(count <= n) {
                    console.log('NO');
                    continue;
                }
                console.log('YES');
                console.log(output.join(" "));
                continue;
            } else {
                console.log('NO');
                continue;
            }
        }

    }

}