Vupsen and Pupsen were gifted an integer array. Since Vupsen doesn't like the number $$$0$$$, he threw away all numbers equal to $$$0$$$ from the array. As a result, he got an array $$$a$$$ of length $$$n$$$.Pupsen, on the contrary, likes the number $$$0$$$ and he got upset when he saw the array without zeroes. To cheer Pupsen up, Vupsen decided to come up with another array $$$b$$$ of length $$$n$$$ such that $$$\sum_{i=1}^{n}a_i \cdot b_i=0$$$. Since Vupsen doesn't like number $$$0$$$, the array $$$b$$$ must not contain numbers equal to $$$0$$$. Also, the numbers in that array must not be huge, so the sum of their absolute values cannot exceed $$$10^9$$$. Please help Vupsen to find any such array $$$b$$$!

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The next $$$2 \cdot t$$$ lines contain the description of test cases. The description of each test case consists of two lines. The first line of each test case contains a single integer $$$n$$$ ($$$2 \le n \le 10^5$$$) — the length of the array. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$-10^4 \le a_i \le 10^4$$$, $$$a_i \neq 0$$$) — the elements of the array $$$a$$$. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$.

For each test case print $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ — elements of the array $$$b$$$ ($$$|b_1|+|b_2|+\ldots +|b_n| \le 10^9$$$, $$$b_i \neq 0$$$, $$$\sum_{i=1}^{n}a_i \cdot b_i=0$$$). It can be shown that the answer always exists.

function solve() {
   const n = Number(read());
   const a = readArray(Number);
   const b = [];
   const odd = (n & 1);
   for (let i = 0; i < n - odd; i++) {
      if (i & 1) {
         b.push(-a[i - 1]);
         continue;
      }
      b.push(a[i + 1]);
   }
   if (odd) {
      const end = [n - 3, n - 2, n - 1];
      while(a[end[0]] + a[end[1]] === 0) {
         end.push(end.shift());
      }
      b[end[0]] = a[end[2]];
      b[end[1]] = a[end[2]];
      b[end[2]] = - a[end[0]] - a[end[1]];
   }
   write(b.join(' '));
}

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

function pDivCount(n) {
   let ans = 0;
   let i = 1;
   while(n > 1) {
      i++;
      while(n % i === 0) {
         ans++;
         n = Math.floor(n / i);
      }
   }
   return ans;
}

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

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

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

		const b = [];
		for (let i = 0; i < (n&1 ? n-3 : n); i+=2) {
			b.push(a[i+1], -a[i]);
		}

		if (n&1) {
			const c = a.slice(-3);
			if (c[0] + c[1] != 0 && b.length < n) b.push(c[2], c[2], -(c[0]+c[1]));
			if (c[0] + c[2] != 0 && b.length < n) b.push(c[1], -(c[0]+c[2]), c[1]);
			if (c[1] + c[2] != 0 && b.length < n) b.push(-(c[1]+c[2]), c[0], c[0]);
		}

		console.log(b.join(' '));
	}
}

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

function rotateLeft (ar, k) {
	while (k--) ar.push(ar.shift());
}

function rotateRight (ar, k) {
	while (k--) ar.unshift(ar.pop());
}

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

		const b = [];
		for (let i = 0; i < (n&1 ? n-3 : n); i++) {
			if (i&1) {
				b.push(-a[i-1])
			} else {
				b.push(a[i+1]);
			}
		}

		if (n&1) {
			const c = a.slice(-3);
			for (let i = 0; i < 3; i++) {
				if (c[0] + c[1] != 0) {
					const res = [c[2], c[2], -(c[0]+c[1])];
					rotateRight(res, i);
					b.push(...res);
					break;
				}
				rotateLeft(c, 1);
			}
		}

		console.log(b.join(' '));
	}
}

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

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

		const b = [];
		for (let i = 0; i < (n&1 ? n-3 : n); i++) {
			if (i&1) {
				b.push(-a[i-1])
			} else {
				b.push(a[i+1]);
			}
		}

		if (n&1) {
			let x = a[n-3], y = a[n-2], z = a[n-1], flg;
			if (Math.abs(x) == Math.abs(y) && Math.abs(y) == Math.abs(z)) {
				b.push(x > 0 ? 1 : -1);
				b.push(y > 0 ? 1 : -1);
				b.push(z > 0 ? -2 : 2);
			} else {
				if (Math.abs(x) == Math.abs(y)) [y, z] = [z, y], flg = 1;
				if (x * y < 0) {
					b.push(z, z, -(x + y));
				} else {
					b.push(z, -z, -(x - y));
				}
				if (flg) b.push(b.pop(), b.pop());
			}
		}

		console.log(b.join(' '));
	}
}

'use strict';

function solve(n, a) {
  if (n === 2) return `${a[1]} ${-a[0]}`;
  const res = [];
  for (let i = 0; i < n - 1; i += 2) {
    res[i] = a[i + 1];
    res[i + 1] = -a[i];
  }
  if (n % 2 === 0) return res.join(' ');
  const [x, y, z] = a.slice(-3);
  if (x + y === 0) {
    res[n - 3] = z;
    res[n - 2] = 2 * z;
    res[n - 1] = -(x + 2 * y);
  } else {
    res[n - 3] = z;
    res[n - 2] = z;
    res[n - 1] = -(x + y);
  }
  return res.join(' ');
}

async function main(read) {
  try {
    let res = [];
    let t = Number(await read());
    while (t--) {
      const n = Number(await read());
      const a = (await read()).split(' ').map(Number);
      res.push(solve(n, a));
    }
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const ans = []
    const limit = (n & 1) ? n - 3 : n
    for (let i = 0; i < limit; i += 2) {
        ans[i] = -arr[i + 1]
        ans[i + 1] = arr[i]
    }
    if (n & 1) {
        const rest = helper(arr[limit], arr[limit + 1], arr[limit + 2])
        return ans.concat(rest).join(' ')
    } else {
        return ans.join(' ')
    }
}
function helper(a, b, c) {
    if (a === b && b === c) {
        return [1, 1, -2]
    } else if (a === b) {
        // return [c, c, 2 * a]
        if (c & 1) {
            if (c === 1) {
                return [-1, 2, -a]
            } else if (c === -1) {
                return [-2, 1, -a]
            }
            return [(c - 1) / 2, (c + 1) / 2, -a]
        } else {
            return [c / 2, c / 2, -a]
        }
    } else if (b === c) {
        if (a & 1) {
            if (a === 1) {
                return [-b, -1, 2]
            } else if (a === -1) {
                return [-b, -2, 1]
            }
            return [-b, (a - 1) / 2, (a + 1) / 2]
        } else {
            return [-b, a / 2, a / 2]
        }
    } else if (a === c) {
        if (b & 1) {
            if (b === 1) {
                return [-1, -a, 2]
            } else if (b === -1) {
                return [-2, -a, 1]
            }
            return [(b - 1) / 2, -a, (b + 1) / 2]
        } else {
            return [b / 2, -a, b / 2]
        }
    }
    let d
    d = a - b
    if (Math.abs(d) < 1e4) {
        return [c, -c, -d]
    }
    d = a - c
    if (Math.abs(d) < 1e4) {
        return [b, -d, -b]
    }
    d = b - c
    return [-d, a, -a]
}

function solve() {
   const n = Number(read());
   const a = readArray(Number);
   const b = [];
   const odd = (n & 1);
   for (let i = 0; i < n - odd; i++) {
      if (i & 1) {
         b.push(-a[i - 1]);
         continue;
      }
      b.push(a[i + 1]);
   }
   if (odd) {
      b[n - 3] = a[n - 1];
      b[n - 2] = a[n - 1];
      b[n - 1] = -a[n - 2] - a[n - 3];
   }
   write(b.join(' '));
}

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

function pDivCount(n) {
   let ans = 0;
   let i = 1;
   while(n > 1) {
      i++;
      while(n % i === 0) {
         ans++;
         n = Math.floor(n / i);
      }
   }
   return ans;
}

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   let minAbsA = 0;
   let minAbsIndex = -1;
   let jopa = 0;
   const a = readArray((value, index) => {
      const curA = Number(value);
      const curAbsA = Math.abs(curA);
      const curJopa = pDivCount(curAbsA);
      if (curJopa > jopa) {
         jopa = curJopa;
         minAbsA = curA;
         minAbsIndex = index;
      }
      return curA;
   });
   const b = [];
   let sum = 0;
   for (let i = 0; i < n; i++) {
      if (i === minAbsIndex) {
         continue;
      }
      const x = lcm(Math.abs(a[i]), minAbsA);
      sum += x;
      b[i] = Math.floor(x / a[i]);
   }
   b[minAbsIndex] = - Math.floor(sum / a[minAbsIndex]);
   write(b.join(' '));
   /*let xxx = 0;
   for (let i = 0; i < n; i++) {
      xxx += Math.abs(b[i]);
   }
   write(xxx);*/
}

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

function pDivCount(n) {
   let ans = 0;
   let i = 1;
   while(n > 1) {
      i++;
      while(n % i === 0) {
         ans++;
         n = Math.floor(n / i);
      }
   }
   return ans;
}

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   let minAbsA = 0;
   let minAbsIndex = -1;
   let jopa = 0;
   const a = readArray((value, index) => {
      const curA = Number(value);
      const curAbsA = Math.abs(curA);
      const curJopa = pDivCount(curAbsA);
      if (curJopa > jopa || curJopa === jopa && curAbsA < minAbsA) {
         jopa = curJopa;
         minAbsA = curA;
         minAbsIndex = index;
      }
      return curA;
   });
   const b = [];
   let sum = 0;
   for (let i = 0; i < n; i++) {
      if (i === minAbsIndex) {
         continue;
      }
      const x = lcm(Math.abs(a[i]), minAbsA);
      sum += x;
      b[i] = Math.floor(x / a[i]);
   }
   b[minAbsIndex] = - Math.floor(sum / a[minAbsIndex]);
   write(b.join(' '));
   /*let xxx = 0;
   for (let i = 0; i < n; i++) {
      xxx += Math.abs(b[i]);
   }
   write(xxx);*/
}

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

function pDivCount(n) {
   let ans = 0;
   let i = 1;
   while(n > 1) {
      i++;
      if (n % i !== 0) {
         continue;
      }
      ans++;
      while(n % i === 0) {
         n = Math.floor(n / i);
      }
   }
   return ans;
}

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   let minAbsA = 0;
   let minAbsIndex = -1;
   const a = readArray((value, index) => {
      const curA = Number(value);
      const curAbsA = Math.abs(curA);
      if (curAbsA > minAbsA) {
         minAbsA = curA;
         minAbsIndex = index;
      }
      return curA;
   });
   const b = [];
   let sum = 0;
   for (let i = 0; i < n; i++) {
      if (i === minAbsIndex) {
         continue;
      }
      const x = lcm(Math.abs(a[i]), minAbsA);
      sum += x;
      b[i] = Math.floor(x / a[i]);
   }
   b[minAbsIndex] = - Math.floor(sum / a[minAbsIndex]);
   write(b.join(' '));
   /*let xxx = 0;
   for (let i = 0; i < n; i++) {
      xxx += a[i] * b[i];
   }
   write(xxx);*/
}

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

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   let minAbsA = Infinity;
   let minAbsIndex = -1;
   let glcm = 1;
   const a = readArray((value) => {
      const curA = Number(value);
      const curAbsA = Math.abs(curA);
      glcm = lcm(glcm, curAbsA);
      return curA;
   });
   for (let i = 0; i < n; i++) {
      const x = Math.floor(glcm / Math.abs(a[i]));
      if (x < minAbsA) {
         minAbsA = x;
         minAbsIndex = i;
      }
   }
   minAbsA = Math.abs(a[minAbsIndex]);
   const b = [];
   let sum = 0;
   for (let i = 0; i < n; i++) {
      if (i === minAbsIndex) {
         continue;
      }
      const x = lcm(Math.abs(a[i]), minAbsA);
      sum += x;
      b[i] = Math.floor(x / a[i]);
   }
   b[minAbsIndex] = - Math.floor(sum / a[minAbsIndex]);
   write(b.join(' '));
   /*let xxx = 0;
   for (let i = 0; i < n; i++) {
      xxx += a[i] * b[i];
   }
   write(xxx);*/
}

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

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   let minAbsA = Infinity;
   let minAbsIndex = -1;
   let glcm = 1;
   const a = readArray((value) => {
      const curA = Number(value);
      const curAbsA = Math.abs(curA);
      glcm = lcm(glcm, curAbsA);
      return curA;
   });
   for (let i = 0; i < n; i++) {
      const x = Math.floor(glcm / Math.abs(a[i]));
      if (x < minAbsA) {
         minAbsA = x;
         minAbsIndex = i;
      }
   }
   minAbsA = Math.abs(a[minAbsIndex]);
   const b = [];
   let sum = 0;
   for (let i = 0; i < n; i++) {
      if (i === minAbsIndex) {
         continue;
      }
      const x = lcm(Math.abs(a[i]), minAbsA);
      sum += x;
      b[i] = Math.floor(x / a[i]);
   }
   b[minAbsIndex] = - Math.floor(sum / a[minAbsIndex]);
   write(b.join(' '));
   let xxx = 0;
   for (let i = 0; i < n; i++) {
      xxx += Math.abs(b[i]);
   }
   write(xxx);
}

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

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

const acode = 'a'.charCodeAt(0);
const zcode = 'z'.charCodeAt(0);

function solve() {
   const n = Number(read());
   let minAbsA = Infinity;
   let minAbsIndex = -1;
   const a = readArray((value, index) => {
      const curA = Number(value);
      const curAbsA = Math.abs(curA);
      if (curAbsA < minAbsA) {
         minAbsA = curA;
         minAbsIndex = index;
      }
      return curA;
   });
   const b = [];
   let sum = 0;
   for (let i = 0; i < n; i++) {
      if (i === minAbsIndex) {
         continue;
      }
      const x = lcm(Math.abs(a[i]), minAbsA);
      sum += x;
      b[i] = Math.floor(x / a[i]);
   }
   b[minAbsIndex] = - Math.floor(sum / a[minAbsIndex]);
   write(b.join(' '));
}

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

function gcd(a, b) {
   if (a === 0) {
      return b;
   }
   return gcd(b % a, a);
}

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

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

function readArray(mapF) {
   var res = read().split(' ');
   if (mapF) {
      res = res.map(mapF);
   }
   return res;
}

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

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }
   MEMORY = fs.readFileSync(inTextName ? require('path').join(__dirname, inTextName) : 0, 'utf8').split('\r\n');
}
init();

function write(value) {
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   if (isNode) {
      return MEMORY;
   }
   var res = [];
   var x;
   while (x = read()) {
      res.push(x);
   }
   return res;
}

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

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

		const b = [];
		for (let i = 0; i < (n&1 ? n-3 : n); i++) {
			if (i&1) {
				b.push(-a[i-1])
			} else {
				b.push(a[i+1]);
			}
		}

		if (n&1) {
			let x = a[n-3], y = a[n-2], z = a[n-3];
			if (Math.abs(x) == Math.abs(y) && Math.abs(y) == Math.abs(z)) {
				if (x > 0) b.push(1); else b.push(-1);
				if (y > 0) b.push(1); else b.push(-1);
				if (z > 0) b.push(-2); else b.push(2);
			} else if (Math.abs(x) == Math.abs(y)) {
				if (x * z < 0) {
					b.push(y, -(x + z), y);
				} else {
					b.push(y, -(x - z), -y);
				}
			} else {
				if (x * y < 0) {
					b.push(z, z, -(x + y));
				} else {
					b.push(z, -z, -(x - y));
				}
			}
		}

		console.log(b.join(' '));
	}
}

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

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

		const b = [];
		for (let i = 0; i < (n&1 ? n-3 : n); i++) {
			if (i&1) {
				b.push(-a[i-1])
			} else {
				b.push(a[i+1]);
			}
		}

		if (n&1) {
			let x = a[n-3], y = a[n-2], z = a[n-3];
			if (Math.abs(x) == Math.abs(y) && Math.abs(y) == Math.abs(z)) {
				if (x > 0) b.push(1); else b.push(-1);
				if (y > 0) b.push(1); else b.push(-1);
				if (z > 0) b.push(-2); else b.push(2);
			} else if (Math.abs(x) == Math.abs(y)) {
				if (a[n-3] * a[n-1] < 0) {
					b.push(a[n-2], a[n-2], -(a[n-3] + a[n-1]));
				} else {
					b.push(a[n-2], -a[n-2], -(a[n-3] - a[n-1]));
				}

			} else {
				if (a[n-3] * a[n-2] < 0) {
					b.push(a[n-1], a[n-1], -(a[n-3] + a[n-2]));
				} else {
					b.push(a[n-1], -a[n-1], -(a[n-3] - a[n-2]));
				}
			}
		}

		console.log(b.join(' '));
	}
}

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

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

		const b = [];
		for (let i = 0; i < (n&1 ? n-3 : n); i++) {
			if (i&1) {
				b.push(-a[i-1])
			} else {
				b.push(a[i+1]);
			}
		}

		if (n&1) {
			// a[n-3], a[n-2], a[n-1]
			if (a[n-3] * a[n-2] < 0) {
				b.push(a[n-1], a[n-1], -(a[n-3] + a[n-2]));
			} else {
				b.push(a[n-1], -a[n-1], -(a[n-3] - a[n-2]));
			}
		}

		console.log(b.join(' '));
	}
}

'use strict';

function solve(n, a) {
  if (n === 2) return `${a[1]} ${-a[0]}`;
  const res = [];
  for (let i = 0; i < n - 3; i += 2) {
    res[i] = a[i + 1];
    res[i + 1] = -a[i];
  }
  const [x, y, z] = a.slice(-3);
  if (x + y === 0) {
    res[n - 3] = z;
    res[n - 2] = 2 * z;
    res[n - 1] = -(x + 2 * y);
  } else {
    res[n - 3] = z;
    res[n - 2] = z;
    res[n - 1] = -(x + y);
  }
  return res.join(' ');
}

async function main(read) {
  try {
    let res = [];
    let t = Number(await read());
    while (t--) {
      const n = Number(await read());
      const a = (await read()).split(' ').map(Number);
      res.push(solve(n, a));
    }
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});

'use strict';

function solve(n, a) {
  let sum = 0,
      res = new Array(n),
      last = a[a.length - 1];
  for (let i = 0; i < n - 1; i++) {
    let flag = a[i] < 0 ? -1 : 1;
    if (sum < 0) {
      sum += flag * a[i];
      res[i] = flag * last;
    } else {
      sum += -1 * flag * a[i];
      res[i] = -flag * last;
    }
  }
  res[n - 1] = -sum;
  return res.join(' ');
}

async function main(read) {
  try {
    let res = [];
    let t = Number(await read());
    while (t--) {
      const n = Number(await read());
      const a = (await read()).split(' ').map(Number);
      res.push(solve(n, a));
    }
    console.log(res.join('\n'));
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', () => {
  inputs = str.split('\n').values();
  main(read);
});

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const ans = []
    const limit = (n & 1) ? n - 3 : n
    for (let i = 0; i < limit; i += 2) {
        ans[i] = -arr[i + 1]
        ans[i + 1] = arr[i]
    }
    if (n & 1) {
        const rest = helper(arr[limit], arr[limit + 1], arr[limit + 2])
        return ans.concat(rest).join(' ')
    } else {
        return ans.join(' ')
    }
}
function helper(a, b, c) {
    if (a === b && b === c) {
        return [1, 1, -2]
    } else if (a === b) {
        // return [c, c, 2 * a]
        if (c & 1) {
            return [(c - 1) / 2, (c + 1) / 2, -a]
        } else {
            return [c / 2, c / 2, -a]
        }
    } else if (b === c) {
        if (a & 1) {
            return [-b, (a - 1) / 2, (a + 1) / 2]
        } else {
            return [-b, a / 2, a / 2]
        }
    } else if (a === c) {
        if (b & 1) {
            return [(b - 1) / 2, -a, (b + 1) / 2]
        } else {
            return [b / 2, -a, b / 2]
        }
    }
    let d
    d = a - b
    if (Math.abs(d) < 1e4) {
        return [c, -c, -d]
    }
    d = a - c
    if (Math.abs(d) < 1e4) {
        return [b, -d, -b]
    }
    d = b - c
    return [-d, a, -a]
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        const n = +lines[l++]
        const arr = lines[l++].trim().split(' ').map(Number)
        output[i] = solve(n, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, arr) {
    const ans = []
    const limit = (n & 1) ? n - 3 : n
    for (let i = 0; i < limit; i += 2) {
        ans[i] = -arr[i + 1]
        ans[i + 1] = arr[i]
    }
    if (n & 1) {
        const rest = helper(arr[limit], arr[limit + 1], arr[limit + 2])
        return ans.concat(rest).join(' ')
    } else {
        return ans.join(' ')
    }
}
function helper(a, b, c) {
    let d
    d = a - b
    if (Math.abs(d) < 1e4) {
        return [c, -c, -d]
    }
    d = a - c
    if (Math.abs(d) < 1e4) {
        return [b, -d, -b]
    }
    d = b - c
    return [-d, a, -a]
}


Little Petya often travels to his grandmother in the countryside. The grandmother has a large garden, which can be represented as a rectangle 1 × n in size, when viewed from above. This rectangle is divided into n equal square sections. The garden is very unusual as each of the square sections possesses its own fixed height and due to the newest irrigation system we can create artificial rain above each section.Creating artificial rain is an expensive operation. That's why we limit ourselves to creating the artificial rain only above one section. At that, the water from each watered section will flow into its neighbouring sections if their height does not exceed the height of the section. That is, for example, the garden can be represented by a 1 × 5 rectangle, where the section heights are equal to 4, 2, 3, 3, 2. Then if we create an artificial rain over any of the sections with the height of 3, the water will flow over all the sections, except the ones with the height of 4. See the illustration of this example at the picture:  As Petya is keen on programming, he decided to find such a section that if we create artificial rain above it, the number of watered sections will be maximal. Help him.

The first line contains a positive integer n (1 ≤ n ≤ 1000). The second line contains n positive integers which are the height of the sections. All the numbers are no less than 1 and not more than 1000.

Print a single number, the maximal number of watered sections if we create artificial rain above exactly one section.

'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const hs = ipt.split(EOL)[1].split(' ').map(v => parseInt(v))
  let c = 1
  let b = 1
  let i = 0
  while (i < hs.length) {
    for (let k = i - 1; k >= 0; k--) {
      if (hs[k] <= hs[k + 1]) c++
      else break
    }
    i++
    for (; i < hs.length; i++) {
      if (hs[i] <= hs[i - 1]) c++
      else break
    }
    if (c > b) b = c
    c = 1
  }
  console.log(b)
})

var inputLength = readline()
var input = readline().split(" ").map(x => parseInt(x)); // num will be an array [1,2,3]

var maxSections = 0, currentSections, pointer;
for (var i = 0; i < inputLength; i++) {
  currentSections = 0;
  for (pointer = i; pointer > 0; pointer--) {
    if (input[pointer - 1] > input[pointer]) {
      break;
    }
    currentSections++;
  }
  for (pointer = i; pointer < inputLength - 1; pointer++) {
    if (input[pointer + 1] > input[pointer]) {
      break;
    }
    currentSections++;
  }
  if (currentSections > maxSections) {
    maxSections = currentSections;
  }
}
print(maxSections + 1)

/**
 * Created by artyom.
 */

len = readline();
a = readline().split(' ').map(function (v) {
    return parseInt(v);
});

function calcRight(start) {
    var pos = start + 1;
    while (pos <= len && a[pos] <= a[pos - 1]) {
        pos++;
    }
    return pos - start;
}

b = [calcRight(0)];
r = [b[0]];
for (var i = 1; i < len; i++) {
    if (a[i] > a[i - 1]) {
        r[i] = calcRight(i);
        b[i] = r[i] + b[i - 1];
    } else {
        r[i] = r[i - 1] - 1;
        b[i] = a[i] < a[i - 1] ? r[i] : b[i - 1];
    }
}

print(Math.max.apply(Math, b));

var print = this.print || require('lol-io').print
var write = this.write || require('lol-io').write
var readline = this.readline || require('lol-io').readline

var n=parseInt(readline());

var arr=readline().split(' ').map(a=>parseInt(a));

var max=0;
for(var i=0;i<arr.length;i++){
    var count=1;
    var c=i;
      for(var j=i+1;j<arr.length;j++){

              if(arr[j]<=arr[c]){
               count++;
              }else{
                  break;
              }
             c++;

      }
       c=i;
      for(var k=i-1;k>=0;k--){

        if(arr[k]<=arr[c]){
            count++;
           }else{
               break;
           }
         c--;

      }
      max=Math.max(max,count);

}
print(max)

var print = this.print || require('lol-io').print
var write = this.write || require('lol-io').write
var readline = this.readline || require('lol-io').readline

var n=parseInt(readline());

var arr=readline().split(' ').map(a=>parseInt(a));

var max=0;
for(var i=0;i<arr.length;i++){
    var count=1;
      for(var j=i;j<arr.length;j++){
         if(arr[j+1]!=undefined){
              if(arr[j+1]<=arr[j]){
               count++;
              }else{
                  break;
              }

         }

         max=Math.max(max,count);
      }
      for(var k=i;k>=0;k--){
        if(k-1>=0){
        if(arr[k-1]<=arr[k]){
            count++;
           }else{
               break;
           }

        }

        max=Math.max(max,count);
      }

}
print(max);

'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const hs = ipt.split(EOL)[1].split(' ').map(v => parseInt(v))
  let c = 1
  let b = 1
  let i = 0
  while (i < hs.length) {
    for (let k = i - 1; k >= 0; k--) {
      if (hs[k] < hs[k + 1]) c++
      else break
    }
    i++
    for (; i < hs.length; i++) {
      if (hs[i] < hs[i - 1]) c++
      else break
    }
    if (c > b) b = c
    c = 1
  }
  console.log(b)
})

/**
 * Created by artyom.
 */

n = readline();
a = readline().split(' ');
len = a.length;

function calcRight(start) {
    var pos = start + 1;
    while (pos <= len && a[pos] <= a[pos - 1]) {
        pos++;
    }
    return pos - start;
}

b = [calcRight(0)];
r = [b[0]];
for (var i = 1; i < len; i++) {
    if (a[i] > a[i - 1]) {
        r[i] = calcRight(i);
        b[i] = r[i] + b[i - 1];
    } else {
        r[i] = r[i - 1] - 1;
        b[i] = r[i];
    }
}
print(Math.max.apply(Math, b));

/**
 * Created by artyom.
 */

n = readline();
a = readline().split(' ');
len = a.length;

function calcRight(start) {
    var pos = start + 1;
    while (pos <= len && a[pos] <= a[pos - 1]) {
        pos++;
    }
    return pos - start;
}

b = [calcRight(0)];
r = [b[0]];
for (var i = 1; i < len; i++) {
    if (a[i] > a[i - 1]) {
        r[i] = calcRight(i);
        b[i] = r[i] + b[i - 1];
    } else {
        r[i] = r[i - 1] - 1;
        b[i] = a[i] < a[i - 1] ? r[i] : b[i - 1];
    }
}
print(Math.max.apply(Math, b));

var print = this.print || require('lol-io').print
var write = this.write || require('lol-io').write
var readline = this.readline || require('lol-io').readline

var n=parseInt(readline());

var arr=readline().split(' ').map(a=>parseInt(a));

var max=0;
for(var i=0;i<arr.length;i++){
    var count=1;
      for(var j=i+1;j<arr.length;j++){

              if(arr[j+1]<=arr[j]){
               count++;
              }else{
                  break;
              }

    }

         max=Math.max(max,count);

      for(var k=i-1;k>=0;k--){

        if(arr[k-1]<=arr[k]){
            count++;
           }else{
               break;
           }

        max=Math.max(max,count);
    }

}
print(max);


Luckily, Serval got onto the right bus, and he came to the kindergarten on time. After coming to kindergarten, he found the toy bricks very funny.He has a special interest to create difficult problems for others to solve. This time, with many $$$1 \times 1 \times 1$$$ toy bricks, he builds up a 3-dimensional object. We can describe this object with a $$$n \times m$$$ matrix, such that in each cell $$$(i,j)$$$, there are $$$h_{i,j}$$$ bricks standing on the top of each other.However, Serval doesn't give you any $$$h_{i,j}$$$, and just give you the front view, left view, and the top view of this object, and he is now asking you to restore the object. Note that in the front view, there are $$$m$$$ columns, and in the $$$i$$$-th of them, the height is the maximum of $$$h_{1,i},h_{2,i},\dots,h_{n,i}$$$. It is similar for the left view, where there are $$$n$$$ columns. And in the top view, there is an $$$n \times m$$$ matrix $$$t_{i,j}$$$, where $$$t_{i,j}$$$ is $$$0$$$ or $$$1$$$. If $$$t_{i,j}$$$ equals $$$1$$$, that means $$$h_{i,j}>0$$$, otherwise, $$$h_{i,j}=0$$$.However, Serval is very lonely because others are bored about his unsolvable problems before, and refused to solve this one, although this time he promises there will be at least one object satisfying all the views. As his best friend, can you have a try?

The first line contains three positive space-separated integers $$$n, m, h$$$ ($$$1\leq n, m, h \leq 100$$$) — the length, width and height. The second line contains $$$m$$$ non-negative space-separated integers $$$a_1,a_2,\dots,a_m$$$, where $$$a_i$$$ is the height in the $$$i$$$-th column from left to right of the front view ($$$0\leq a_i \leq h$$$). The third line contains $$$n$$$ non-negative space-separated integers $$$b_1,b_2,\dots,b_n$$$ ($$$0\leq b_j \leq h$$$), where $$$b_j$$$ is the height in the $$$j$$$-th column from left to right of the left view. Each of the following $$$n$$$ lines contains $$$m$$$ numbers, each is $$$0$$$ or $$$1$$$, representing the top view, where $$$j$$$-th number of $$$i$$$-th row is $$$1$$$ if $$$h_{i, j}>0$$$, and $$$0$$$ otherwise. It is guaranteed that there is at least one structure satisfying the input.

Output $$$n$$$ lines, each of them contains $$$m$$$ integers, the $$$j$$$-th number in the $$$i$$$-th line should be equal to the height in the corresponding position of the top view. If there are several objects satisfying the views, output any one of them.

Note  The graph above illustrates the object in the first example.    The first graph illustrates the object in the example output for the second example, and the second graph shows the three-view drawing of it.

const readline = require('readline');

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

function readLines(number, cb) {
    const lines = [];
    rl.on('line', function(line) {
        lines.push(line);
        if (lines.length === number) {
            rl.close();
            cb(lines);
        }
    });
};

function readLines(cb) {
    const lines = [];
    let read;
    rl.on('line', function(line) {
        if (!read) {
            const first = line.split(' ').map(x=>parseInt(x));
            read = first[0] +2;
        } else {
            lines.push(line);
        }
        if (lines.length === read) {
            rl.close();
            cb(lines);
        }
    });
};
readLines(doIt);

function doIt(lines) {
    const frontView = lines[0].split(' ').map(x=>parseInt(x));
    const leftView = lines[1].split(' ').map(x=>parseInt(x));
    const matrix = lines.slice(2).map(line => line.split(' ').map(x=>parseInt(x)));

    for (let row = 0; row < leftView.length; row++) {
        const aRow = [];
        for (let col = 0; col < frontView.length;col++) {
            if (matrix[row][col] === 0)
                aRow.push(0);
            else {
                aRow.push(Math.min(frontView[col], leftView[row]));;
            }
        }
        console.log(aRow.join(' '));
    }
}

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

function sol() {
  const [meta, front, left, ...top] = input
    .split('\n')
    .map(line => line.split(' ').map(Number));

  const [n, m, h] = meta;
  const result = [];
  for (let k = 0; k < n; ++k)
    result.push(Array(m).fill(0));

  // front: 0 .. m-1
  // fill all columns with maximum value
  for (let i = 0; i < m; ++i) {
    for (let j = 0; j < n; ++j) {
      if (top[j][i] === 0) continue;
      result[j][i] = front[i];
    }
  }

  // left: 0 .. n-1
  for (let j = 0; j < n; ++j) {
    for (let i = 0; i < m; ++i) {
      if (top[j][i] === 0) continue;
      if (result[j][i] > left[j]) {
        result[j][i] = left[j];
      }
    }
  }

  process.stdout.write(
    result.map(line => line.join(' ')).join('\n'),
    'utf8',
    () => process.stdout.end()
  );
}

(function() {
    var read = {
        number: function() {
            return +readline();
        },
        arr: function(divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function(divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    }

    var line = read.arrNumber(' ');
    var n = line[0];
    var m = line[1];
    var h = line[2];

    var ms = read.arrNumber(' ');
    var ns = read.arrNumber(' ');

    var res;
    for(var i = 0; i < n; i++) {
        line = read.arrNumber(' ');
        res = [];
        line.forEach(function (count, index) {
           res[index] = count
               ? (ms[index] > ns[i] ? ns[i] : ms[index])
               : 0
        });
        print(res.join(' '));
    }

}());


Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 100 000, inclusive. It is possible that some cards have the same integers on them.Vasily decided to sort the cards. To do this, he repeatedly takes the top card from the deck, and if the number on it equals the minimum number written on the cards in the deck, then he places the card away. Otherwise, he puts it under the deck and takes the next card from the top, and so on. The process ends as soon as there are no cards in the deck. You can assume that Vasily always knows the minimum number written on some card in the remaining deck, but doesn't know where this card (or these cards) is.You are to determine the total number of times Vasily takes the top card from the deck.

The first line contains single integer n (1 ≤ n ≤ 100 000) — the number of cards in the deck. The second line contains a sequence of n integers a1, a2, ..., an (1 ≤ ai ≤ 100 000), where ai is the number written on the i-th from top card in the deck.

Print the total number of times Vasily takes the top card from the deck.

NoteIn the first example Vasily at first looks at the card with number 6 on it, puts it under the deck, then on the card with number 3, puts it under the deck, and then on the card with number 1. He places away the card with 1, because the number written on it is the minimum among the remaining cards. After that the cards from top to bottom are [2, 6, 3]. Then Vasily looks at the top card with number 2 and puts it away. After that the cards from top to bottom are [6, 3]. Then Vasily looks at card 6, puts it under the deck, then at card 3 and puts it away. Then there is only one card with number 6 on it, and Vasily looks at it and puts it away. Thus, in total Vasily looks at 7 cards.


The Queen of England has n trees growing in a row in her garden. At that, the i-th (1 ≤ i ≤ n) tree from the left has height ai meters. Today the Queen decided to update the scenery of her garden. She wants the trees' heights to meet the condition: for all i (1 ≤ i < n), ai + 1 - ai = k, where k is the number the Queen chose.Unfortunately, the royal gardener is not a machine and he cannot fulfill the desire of the Queen instantly! In one minute, the gardener can either decrease the height of a tree to any positive integer height or increase the height of a tree to any positive integer height. How should the royal gardener act to fulfill a whim of Her Majesty in the minimum number of minutes?

The first line contains two space-separated integers: n, k (1 ≤ n, k ≤ 1000). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 1000) — the heights of the trees in the row.

In the first line print a single integer p — the minimum number of minutes the gardener needs. In the next p lines print the description of his actions.  If the gardener needs to increase the height of the j-th (1 ≤ j ≤ n) tree from the left by x (x ≥ 1) meters, then print in the corresponding line "+ j x". If the gardener needs to decrease the height of the j-th (1 ≤ j ≤ n) tree from the left by x (x ≥ 1) meters, print on the corresponding line "- j x". If there are multiple ways to make a row of trees beautiful in the minimum number of actions, you are allowed to print any of them.

print(function(n, k) {
	var a = readline().split(' ').map(Number);
	var min = 1e6;
	var s = 0;
	for (var i = 1; i <= 1000; i++) {
		var x = 0;
		for (var j = 0; j < n; j++) {
			if (a[j] !== i + j * k) {
				x++;
			}
		}
		if (x < min) {
			min = x;
			s = i
		}
	}
	var ans = [];
	for (var i = 0; i < n; i++) {
		var x = s + i * k - a[i];
		if (x > 0) {
			ans.push('+ ' + (i + 1) + ' ' + x);
		} else if (x < 0) {
			ans.push('- ' + (i + 1) + ' ' + (-x));
		}
	}

	return ans.length == 0 ? ans.length : ans.length + '\n' + ans.join('\n')
}.apply(0, readline().split(' ').map(Number)));

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var treeNum = integers[0], delta = integers[1];
	var trees = tokenizeIntegers(readline());
	var bestCost = treeNum, bestActions;
		maxStartingHeight = 1000;

	for (var start = 1; start <= maxStartingHeight; ++start) {
		var current = start, cost = 0;
		var actions = [];
		for (var i = 0; i < treeNum; ++i) {
			if (trees[i] != current) {
				cost += 1;
				actions.push([current < trees[i] ? "-" : "+",
						i+1, Math.abs(current-trees[i])].join(" "));
			}
			current += delta;
		}
		if (cost < bestCost) {
			bestCost = cost;
			bestActions = actions;
		}
	}

	print(bestCost);
	if (bestCost > 0) {
		print(bestActions.join("\n"));
	}
}

main();

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var treeNum = integers[0], delta = integers[1];
	var trees = tokenizeIntegers(readline());
	var bestCost = treeNum, bestActions;
		maxStartingHeight = 1000;

	for (var start = 1; start <= maxStartingHeight; ++start) {
		var height = start, cost = 0;
		var actions = [];
		for (var i = 0; i < treeNum; ++i) {
			if (trees[i] != height) {
				cost += 1;
				actions.push([height < trees[i] ? "-" : "+",
						i+1, Math.abs(height-trees[i])].join(" "));
			}
			height += delta;
		}
		if (cost < bestCost) {
			bestCost = cost;
			bestActions = actions;
		}
	}

	print(bestCost);
	if (bestCost > 0) {
		print(bestActions.join("\n"));
	}
}

main();

function trim(s) {
	return s.replace(/^\s+|\s+$/gm, '');
}

function tokenize(s) {
	return trim(s).split(/\s+/);
}

function tokenizeIntegers(s) {
	var tokens = tokenize(s);
	for (var i = 0; i < tokens.length; i += 1) {
		tokens[i] = parseInt(tokens[i]);
	};
	return tokens;
}

function main() {
	var integers = tokenizeIntegers(readline());
	var treeNum = integers[0], delta = integers[1];
	var trees = tokenizeIntegers(readline());
	var bestCost = treeNum, bestActions;
		maxStartingHeight = 1000;

	for (var start = 1; start <= maxStartingHeight; ++start) {
		var current = start, cost = 0;
		var actions = [];
		for (var i = 0; i < treeNum; ++i) {
			if (current > maxStartingHeight) {
				cost += treeNum - i;
				break;
			}
			if (trees[i] != current) {
				cost += 1;
				actions.push([current < trees[i] ? "-" : "+",
						i+1, Math.abs(current-trees[i])].join(" "));
			}
			current += delta;
		}
		if (cost < bestCost) {
			bestCost = cost;
			bestActions = actions;
		}
	}

	print(bestCost);
	if (bestCost > 0) {
		print(bestActions.join("\n"));
	}
}

main();


Danny, the local Math Maniac, is fascinated by circles, Omkar's most recent creation. Help him solve this circle problem!You are given $$$n$$$ nonnegative integers $$$a_1, a_2, \dots, a_n$$$ arranged in a circle, where $$$n$$$ must be odd (ie. $$$n-1$$$ is divisible by $$$2$$$). Formally, for all $$$i$$$ such that $$$2 \leq i \leq n$$$, the elements $$$a_{i - 1}$$$ and $$$a_i$$$ are considered to be adjacent, and $$$a_n$$$ and $$$a_1$$$ are also considered to be adjacent. In one operation, you pick a number on the circle, replace it with the sum of the two elements adjacent to it, and then delete the two adjacent elements from the circle. This is repeated until only one number remains in the circle, which we call the circular value.Help Danny find the maximum possible circular value after some sequences of operations.

The first line contains one odd integer $$$n$$$ ($$$1 \leq n < 2 \cdot 10^5$$$, $$$n$$$ is odd)  — the initial size of the circle. The second line contains $$$n$$$ integers $$$a_{1},a_{2},\dots,a_{n}$$$ ($$$0 \leq a_{i} \leq 10^9$$$)  — the initial numbers in the circle.

Output the maximum possible circular value after applying some sequence of operations to the given circle.

NoteFor the first test case, here's how a circular value of $$$17$$$ is obtained:Pick the number at index $$$3$$$. The sum of adjacent elements equals $$$17$$$. Delete $$$7$$$ and $$$10$$$ from the circle and replace $$$2$$$ with $$$17$$$.Note that the answer may not fit in a $$$32$$$-bit integer.

function solve() {
   var n = Number(read());
   var a = read().split(' ');
   var a0 = [];
   var a1 = [];
   var s = [];
   for (var i = 0; i < n; i++) {
      var x = BigInt(a[i]);
      if (i & 1) {
         a1.push(x);
      } else {
         a0.push(x);
      }
   }
   a.length = 0;
   s.push(a0[0]);
   for (var i = 1; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   for (var i = 0; i < a1.length; i++) {
      s.push(s[s.length - 1] + a1[i]);
   }
   for (var i = 0; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   var ans = 0n;
   var hn = Math.floor((n + 1) / 2);
   for (var i = 0; i < n; i++) {
      var sn = s[i + hn] - s[i];
      if (sn > ans) {
         ans = sn;
      }
   }
   write('' + ans);
}

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

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

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

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

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

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

function solve() {
   var n = Number(read());
   var a = read().split(' ');
   var a0 = [];
   var a1 = [];
   var s = [];
   for (var i = 0; i < n; i++) {
      var x = BigInt(a[i]);
      if (i & 1) {
         a1.push(x);
      } else {
         a0.push(x);
      }
   }
   s.push(a0[0]);
   for (var i = 1; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   for (var i = 0; i < a1.length; i++) {
      s.push(s[s.length - 1] + a1[i]);
   }
   for (var i = 0; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   for (var i = 0; i < a1.length; i++) {
      s.push(s[s.length - 1] + a1[i]);
   }
   var ans = 0n;
   var hn = Math.floor((n + 1) / 2);
   for (var i = 0; i < n; i++) {
      var sn = s[i + hn] - s[i];
      if (sn > ans) {
         ans = sn;
      }
   }
   write('' + ans);
}

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

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

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

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

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

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

function solve() {
   var n = Number(read());
   var a = read().split(' ');
   var a0 = [];
   var a1 = [];
   var s = [];
   for (var i = 0; i < n; i++) {
      var x = BigInt(a[i]);
      if (i & 1) {
         a1.push(x);
      } else {
         a0.push(x);
      }
   }
   s.push(a0[0]);
   for (var i = 1; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   for (var i = 0; i < a1.length; i++) {
      s.push(s[s.length - 1] + a1[i]);
   }
   for (var i = 0; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   var ans = 0n;
   var hn = Math.floor((n + 1) / 2);
   for (var i = 0; i < n; i++) {
      var sn = s[i + hn] - s[i];
      if (sn > ans) {
         ans = sn;
      }
   }
   write('' + ans);
}

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

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

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

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

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

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

// node template.js < A-small.in > A-small.out

function main() {
    var tests = 1;
    // tests = nextInt();

    for (let t = 1; t <= tests; t++) {
        let N = nextInt();
        let a = [], sum = 0;
        for(let i = 0; i < N; i++) {
            a.push(nextInt());
            sum += a[i];
        }

        if (N===1) {
            print(sum);
            continue;
        }

        for(let i = 0; i < N; i++) {
            a.push(a[i]);
        }

        let at = [take(a, 0), take(a, 1)];
        let st = [accum(at[0]), accum(at[1])];
        // console.log(at);
        // console.log(st);

        let result = sum;
        for(let i = 0; i < N; i++) {
            let j = i + N - 2;
            let odd = (i+1)%2;
            // console.log(st[odd][j] - st[odd][i], i, j, odd, st[odd][j], st[odd][i]);
            result = Math.min(result, st[odd][j] - st[odd][i]);
        }
        // console.log(result);

        print(sum - result);
    }
}

function take(a, odd) {
    let b = [...a];
    for(let i = 0; i < b.length; i++) {
        if (i % 2 !== odd) {
            b[i] = 0;
        }
    }
    return b;
}

function accum(a) {
    let b = [...a];
    for(let i = 1; i < b.length; i++) {
        b[i] = b[i-1] + b[i];
    }
    return b;
}

// ------- Template ------------------
function newTensor(dimensions, value) {
    let res = [];
    let dim = dimensions[0], subdim = dimensions.slice(1);
    if (subdim.length == 0) {
        for(let i = 0; i < dim; i++) {
            res.push(value);
        }
    } else {
        for(let i = 0; i < dim; i++) {
            res.push(newTensor(subdim, value));
        }
    }
    return res;
}

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}
if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
        if (this_len === undefined || this_len > this.length) {
            this_len = this.length;
        }
        return this.substring(this_len - search.length, this_len) === search;
    };
}

var curTokens = [], curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

function nextInt() {
    return parseInt(next());
}

// code for nodejs
var inputBuffer = '', curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + '\n');
}

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

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

process.stdin.on('end', function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});

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

function solve() {
   var n = Number(read());
   var a = read().split(' ').map(BigInt);
   a.sort(sortF);
   var ans = 0n;
   for (var i = Math.floor(n / 2); i < n; i++) {
      ans += a[i];
   }
   write('' + ans);
}

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

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

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

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

function solve() {
   var n = Number(read());
   var a = read().split(' ');
   var a0 = [];
   var a1 = [];
   var s = [];
   for (var i = 0; i < n; i++) {
      var x = BigInt(a[i]);
      if (i & 1) {
         a1.push(x);
      } else {
         a0.push(x);
      }
   }
   s.push(a0[0]);
   for (var i = 1; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   for (var i = 0; i < a1.length; i++) {
      s.push(s[s.length - 1] + a1[i]);
   }
   for (var i = 0; i < a0.length; i++) {
      s.push(s[s.length - 1] + a0[i]);
   }
   for (var i = 0; i < a1.length; i++) {
      s.push(s[s.length - 1] + a1[i]);
   }
   var ans = 0n;
   var hn = Math.floor((n + 1 / 2));
   for (var i = 0; i < n; i++) {
      var sn = s[i + hn - 1] - s[i]
      if (sn > ans) {
         ans = sn;
      }
   }
   write('' + ans);
}

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

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

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

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

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

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

      RL.on('line', (line) => {
         MEMORY.push(line);
      });

      RL.on('close', init);
   }
} else {
   init();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}

// node template.js < A-small.in > A-small.out

function main() {
    var tests = 1;
    // tests = nextInt();

    for (let t = 1; t <= tests; t++) {
        let N = nextInt();
        let a = [], sum = 0;
        for(let i = 0; i < N; i++) {
            a.push(nextInt());
            sum += a[i];
        }

        for(let i = 0; i < N; i++) {
            a.push(a[i]);
        }

        let at = [take(a, 0), take(a, 1)];
        let st = [accum(at[0]), accum(at[1])];
        // console.log(at);
        // console.log(st);

        let result = sum;
        for(let i = 0; i < N; i++) {
            let j = i + N - 2;
            let odd = (i+1)%2;
            // console.log(st[odd][j] - st[odd][i], i, j, odd, st[odd][j], st[odd][i]);
            result = Math.min(result, st[odd][j] - st[odd][i]);
        }
        // console.log(result);

        print(sum - result);
    }
}

function take(a, odd) {
    let b = [...a];
    for(let i = 0; i < b.length; i++) {
        if (i % 2 !== odd) {
            b[i] = 0;
        }
    }
    return b;
}

function accum(a) {
    let b = [...a];
    for(let i = 1; i < b.length; i++) {
        b[i] = b[i-1] + b[i];
    }
    return b;
}

// ------- Template ------------------
function newTensor(dimensions, value) {
    let res = [];
    let dim = dimensions[0], subdim = dimensions.slice(1);
    if (subdim.length == 0) {
        for(let i = 0; i < dim; i++) {
            res.push(value);
        }
    } else {
        for(let i = 0; i < dim; i++) {
            res.push(newTensor(subdim, value));
        }
    }
    return res;
}

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}
if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
        if (this_len === undefined || this_len > this.length) {
            this_len = this.length;
        }
        return this.substring(this_len - search.length, this_len) === search;
    };
}

var curTokens = [], curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

function nextInt() {
    return parseInt(next());
}

// code for nodejs
var inputBuffer = '', curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + '\n');
}

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

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

process.stdin.on('end', function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});

// node template.js < A-small.in > A-small.out

function main() {
    var tests = 1;
    // tests = nextInt();

    for (let t = 1; t <= tests; t++) {
        let N = nextInt();
        let a = [], sum = 0;
        for(let i = 0; i < N; i++) {
            a.push(nextInt());
            sum += a[i];
        }

        for(let i = 0; i < N; i++) {
            a.push(a[i]);
        }

        let at = [take(a, 0), take(a, 1)];
        let st = [accum(at[0]), accum(at[1])];

        let result = sum;
        for(let i = 0; i < N; i++) {
            let j = i + N-2;
            let odd = i%2;
            result = Math.min(result, st[odd][j] - st[odd][i]);
        }

        print(sum - result);
    }
}

function take(a, odd) {
    let b = [...a];
    for(let i = 0; i < b.length; i++) {
        if (i % 2 === odd) {
            b[i] = 0;
        }
    }
    return b;
}

function accum(a) {
    let b = [...a];
    for(let i = 1; i < b.length; i++) {
        b[i] = b[i-1] + b[i];
    }
    return b;
}

// ------- Template ------------------
function newTensor(dimensions, value) {
    let res = [];
    let dim = dimensions[0], subdim = dimensions.slice(1);
    if (subdim.length == 0) {
        for(let i = 0; i < dim; i++) {
            res.push(value);
        }
    } else {
        for(let i = 0; i < dim; i++) {
            res.push(newTensor(subdim, value));
        }
    }
    return res;
}

if (!String.prototype.startsWith) {
    Object.defineProperty(String.prototype, 'startsWith', {
        value: function(search, rawPos) {
            var pos = rawPos > 0 ? rawPos|0 : 0;
            return this.substring(pos, pos + search.length) === search;
        }
    });
}
if (!String.prototype.endsWith) {
    String.prototype.endsWith = function(search, this_len) {
        if (this_len === undefined || this_len > this.length) {
            this_len = this.length;
        }
        return this.substring(this_len - search.length, this_len) === search;
    };
}

var curTokens = [], curToken = 0;

function next() {
    while (curToken >= curTokens.length) {
        curTokens = readline().split(/[\s]+/);
        curToken = 0;
    }
    return curTokens[curToken++];
}

function nextInt() {
    return parseInt(next());
}

// code for nodejs
var inputBuffer = '', curLine = 0;

function readline() {
    return inputBuffer[curLine++];
}

function print(data) {
    process.stdout.write(data + '\n');
}

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

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

process.stdin.on('end', function () {
    inputBuffer = inputBuffer.split(/[\s]+/);
    main();
});


Alice has a birthday today, so she invited home her best friend Bob. Now Bob needs to find a way to commute to the Alice's home.In the city in which Alice and Bob live, the first metro line is being built. This metro line contains $$$n$$$ stations numbered from $$$1$$$ to $$$n$$$. Bob lives near the station with number $$$1$$$, while Alice lives near the station with number $$$s$$$. The metro line has two tracks. Trains on the first track go from the station $$$1$$$ to the station $$$n$$$ and trains on the second track go in reverse direction. Just after the train arrives to the end of its track, it goes to the depot immediately, so it is impossible to travel on it after that.Some stations are not yet open at all and some are only partially open — for each station and for each track it is known whether the station is closed for that track or not. If a station is closed for some track, all trains going in this track's direction pass the station without stopping on it.When the Bob got the information on opened and closed stations, he found that traveling by metro may be unexpectedly complicated. Help Bob determine whether he can travel to the Alice's home by metro or he should search for some other transport.

The first line contains two integers $$$n$$$ and $$$s$$$ ($$$2 \le s \le n \le 1000$$$) — the number of stations in the metro and the number of the station where Alice's home is located. Bob lives at station $$$1$$$. Next lines describe information about closed and open stations. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$a_i = 0$$$ or $$$a_i = 1$$$). If $$$a_i = 1$$$, then the $$$i$$$-th station is open on the first track (that is, in the direction of increasing station numbers). Otherwise the station is closed on the first track. The third line contains $$$n$$$ integers $$$b_1, b_2, \ldots, b_n$$$ ($$$b_i = 0$$$ or $$$b_i = 1$$$). If $$$b_i = 1$$$, then the $$$i$$$-th station is open on the second track (that is, in the direction of decreasing station numbers). Otherwise the station is closed on the second track.

Print "YES" (quotes for clarity) if Bob will be able to commute to the Alice's home by metro and "NO" (quotes for clarity) otherwise. You can print each letter in any case (upper or lower).

NoteIn the first example, all stations are opened, so Bob can simply travel to the station with number $$$3$$$.In the second example, Bob should travel to the station $$$5$$$ first, switch to the second track and travel to the station $$$4$$$ then.In the third example, Bob simply can't enter the train going in the direction of Alice's home.

var ns = readline().split(' ');
var a = readline().split(' ');
var b = readline().split(' ');

var n = parseInt(ns[0]);
var s = parseInt(ns[1]);
var bobStation = 1;

var checkMetro = function (stations, aliceStation, goStationsStatus, returnStationsStatus) {
    if (goStationsStatus[bobStation - 1] == 0) {
        print('NO');
        return;
    }

    if (goStationsStatus[aliceStation - 1] == 0
        && returnStationsStatus[aliceStation - 1] == 0) {
        print('NO');
        return;
    }

    if (goStationsStatus[aliceStation - 1] == 1) {
        print('YES');
        return;
    }

    for (var i = aliceStation + 1; i <= stations; i++) {
        if (goStationsStatus[i - 1] == 1 && returnStationsStatus[i - 1] == 1) {
            print('YES');
            return;
        }
    }
    print('NO');
}

checkMetro(n, s, a, b);

var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
var n=numbers[0]
var goal_node=numbers[1]
var a_line=readline().split(" ").map(function(x) { return parseInt(x); });
var b_line=readline().split(" ").map(function(x) { return parseInt(x); });
var yes=false

if(a_line[0] == 0 || (a_line[goal_node-1] == 0 && b_line[goal_node-1] == 0)) {
  yes=false
}
else if(a_line[goal_node-1] == 1) {
  yes=true
} else {
  for(var i=goal_node-1;i<n;i++) {
    if(a_line[i] == 1 && b_line[i] == 1) {
      yes=true;
      break;
    }
  }
}

// if(a_line[0] == 0 || (a_line[goal_node-1] == 0 && b_line[goal_node-1] == 0)) {
//   yes=false
// } else {
//   var visited = [];
//   var a = []
//   for(var i=0; i<n*2; i++) { visited[i] = new Array(n*2); a[i] = new Array(n*2); }

//   for(var i=0; i<n*2; i++) {
//     for(var j=0;j<n;j++) {
//       if (i < n) {
//         if (j > i && a_line[i] != 0 && a_line[j] != 0) { a[i][j] = 1 }
//         if (i == j && a_line[j] != 0 && b_line[j] != 0) { a[i][n+j] = 1; a[n+j][i] = 1; }
//       } else {
//         if (n+j < i && b_line[j] != 0) { a[i][n+j] = 1 }
//       }
//     }
//   }

//   var queue=[]
//   queue.push([0,0]);
//   visited[0][0] = true;

//   while(queue.length != 0) {
//     var node = queue.shift();
//     if(node[0] == goal_node-1 || node[1] == goal_node-1 || node[0] == n+goal_node-1 || node[1] == n+goal_node-1) {
//       yes=true;
//       break;
//     }
//     for(var i=0;i<n*2;i++) {
//       if (a[node[1]][i] == 1) {
//         child = a[node[1]][i]
//         if(visited[node[1]][i] != true) {
//           queue.push([node[1],i]);
//           visited[node[1]][i] = true;
//         }
//       }
//     }
//   }
// }

if (yes) {
  print("YES")
} else {
  print("NO")
}

var st = readline().split(" ");
var al = +st[1];
way1 = readline().split(" ");
way2 = readline().split(" ");

function haveStation(pos){
    for(var i = pos; i < way1.length; i++){
        if(way1[i] === '1' && way2[i] === '1') return true;
    }
    return false;
}
if(way1[0] === '0' ||
    (way1[al - 1] === '0' && (way2[al - 1] === '0')) ||
    (!haveStation(al) && way1[al - 1] === '0')
)
    print("NO");
else
    print("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*/
    main(lines);
});

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=parseInt(line0[0]);
    let s=parseInt(line0[1]);

    if (line1[0] === '0') {console.log('NO'); return ;}
    if (line1[s-1] === '1') {console.log('YES');return;}
    if (line1[s-1] === '0' && line2[s-1]=== '0') {console.log('NO'); return ;}
    for (let i=s-1; i<n ; i++){

        if (line1[i] === '1' && line2[i] === '1')  {console.log('YES'); return ;}
    }

    console.log('NO');

}

var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
var n=numbers[0]
var goal_node=numbers[1]
var a_line=readline().split(" ").map(function(x) { return parseInt(x); });
var b_line=readline().split(" ").map(function(x) { return parseInt(x); });
var yes=false

if(a_line[0] == 0 || (a_line[goal_node-1] == 0 && b_line[goal_node-1] == 0) || b_line[goal_node-1] == 0) {
  yes=false
} else {
  for(var i=goal_node-1;i<n;i++) {
    if(a_line[i] == 1 && b_line[i] == 1) {
      yes=true;
      break;
    }
  }
}

// if(a_line[0] == 0 || (a_line[goal_node-1] == 0 && b_line[goal_node-1] == 0)) {
//   yes=false
// } else {
//   var visited = [];
//   var a = []
//   for(var i=0; i<n*2; i++) { visited[i] = new Array(n*2); a[i] = new Array(n*2); }

//   for(var i=0; i<n*2; i++) {
//     for(var j=0;j<n;j++) {
//       if (i < n) {
//         if (j > i && a_line[i] != 0 && a_line[j] != 0) { a[i][j] = 1 }
//         if (i == j && a_line[j] != 0 && b_line[j] != 0) { a[i][n+j] = 1; a[n+j][i] = 1; }
//       } else {
//         if (n+j < i && b_line[j] != 0) { a[i][n+j] = 1 }
//       }
//     }
//   }

//   var queue=[]
//   queue.push([0,0]);
//   visited[0][0] = true;

//   while(queue.length != 0) {
//     var node = queue.shift();
//     if(node[0] == goal_node-1 || node[1] == goal_node-1 || node[0] == n+goal_node-1 || node[1] == n+goal_node-1) {
//       yes=true;
//       break;
//     }
//     for(var i=0;i<n*2;i++) {
//       if (a[node[1]][i] == 1) {
//         child = a[node[1]][i]
//         if(visited[node[1]][i] != true) {
//           queue.push([node[1],i]);
//           visited[node[1]][i] = true;
//         }
//       }
//     }
//   }
// }

if (yes) {
  print("YES")
} else {
  print("NO")
}

var numbers = readline().split(" ").map(function(x) { return parseInt(x); });
var n=numbers[0]
var goal_node=numbers[1]
var a_line=readline().split(" ").map(function(x) { return parseInt(x); });
var b_line=readline().split(" ").map(function(x) { return parseInt(x); });
var yes=false

if(a_line[0] == 0 || (a_line[goal_node-1] == 0 && b_line[goal_node-1] == 0)) {
  yes=false
} else {
  for(var i=goal_node-1;i<n;i++) {
    if(a_line[i] == 1 && b_line[i] == 1) {
      yes=true;
      break;
    }
  }
}

// if(a_line[0] == 0 || (a_line[goal_node-1] == 0 && b_line[goal_node-1] == 0)) {
//   yes=false
// } else {
//   var visited = [];
//   var a = []
//   for(var i=0; i<n*2; i++) { visited[i] = new Array(n*2); a[i] = new Array(n*2); }

//   for(var i=0; i<n*2; i++) {
//     for(var j=0;j<n;j++) {
//       if (i < n) {
//         if (j > i && a_line[i] != 0 && a_line[j] != 0) { a[i][j] = 1 }
//         if (i == j && a_line[j] != 0 && b_line[j] != 0) { a[i][n+j] = 1; a[n+j][i] = 1; }
//       } else {
//         if (n+j < i && b_line[j] != 0) { a[i][n+j] = 1 }
//       }
//     }
//   }

//   var queue=[]
//   queue.push([0,0]);
//   visited[0][0] = true;

//   while(queue.length != 0) {
//     var node = queue.shift();
//     if(node[0] == goal_node-1 || node[1] == goal_node-1 || node[0] == n+goal_node-1 || node[1] == n+goal_node-1) {
//       yes=true;
//       break;
//     }
//     for(var i=0;i<n*2;i++) {
//       if (a[node[1]][i] == 1) {
//         child = a[node[1]][i]
//         if(visited[node[1]][i] != true) {
//           queue.push([node[1],i]);
//           visited[node[1]][i] = true;
//         }
//       }
//     }
//   }
// }

if (yes) {
  print("YES")
} else {
  print("NO")
}

var st = readline().split(" ");
var bob = +st[0];
var al = +st[1];
way1 = readline().split(" ");
way2 = readline().split(" ");

function haveStation(pos){
    for(var i = way1[pos]; i < way1.length; i++){
        if(way1[i] && way2[i]) return true;
    }
    return false;
}
if(way1[0] === '0' ||
    (way1[al - 1] === '0' && (way2[al - 1] === '0')) ||
    (!haveStation(al) && way1[al - 1] === '0')
)
    print("NO");
else
    print("YES");

var st = readline().split(" ");
var bob = +st[0];
var al = +st[1];
way1 = readline().split(" ");
way2 = readline().split(" ");

function haveStation(arr, pos){
    for(var i = arr[pos]; i < arr.length; i++){
        if(arr) return true;
    }
    return false;
}
if(way1[0] === '0' || (way1[al - 1] === '0' && (way2[al - 1] === '0')) || (!haveStation(way1, al) && way1[al - 1] === '0'))
    print("NO");
else
    print("YES");

var st = readline().split(" ");
var bob = +st[0];
var al = +st[1];
way1 = readline().split(" ");
way2 = readline().split(" ");

function haveStation(pos){
    for(var i = pos; i < way1.length; i++){
        if(way1[i] && way2[i]) return true;
    }
    return false;
}
if(way1[0] === '0' ||
    (way1[al - 1] === '0' && (way2[al - 1] === '0')) ||
    (!haveStation(al) && way1[al - 1] === '0')
)
    print("NO");
else
    print("YES");

var st = readline().split(" ");
var bob = +st[0];
var al = +st[1];
way1 = readline().split(" ");
way2 = readline().split(" ");

function haveStation(arr, pos){
    for(var i = arr[pos]; i < arr.length; i++){
        if(arr) return true;
    }
    return false;
}
if(way1[0] === '0' || (way1[al - 1] === '0' && (way2[al - 1] === '0')) || !haveStation(way1, al))
    print("NO");
else
    print("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*/
    main(lines);
});

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=line0[0];
    let s=line0[1];
    console.log(n,s);
    if ((line1[0] === 0) || (line2[s-1] === 0)) {console.log('NO'); return}

    for (let i=s-1; i<n ; i++){
        if ((line1[i] === 1) && (line2[i] === 1))  {console.log('YES'); return}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=parseInt(line0[0]);
    let s=parseInt(line0[1]);

    if (line1[0] === '0' || line2[s-1] === '0') {console.log('NO'); return ;}

    for (let i=s-1; i<n ; i++){

        if (line1[i] === '1' && line2[i] === '1')  {console.log('YES'); return ;}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=line0[0];
    let s=line0[1];
    //console.log(n,s);
    if ((line1[0] === 0) || (line2[s-1] === 0)) {console.log('NO'); return}

    for (let i=s-1; i<n ; i++){
        console.log(line1[i]);
        if ((line1[i] === 1) && (line2[i] === 1))  {console.log('YES'); return}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=line0[0];
    let s=line0[1];

    if (line1[0] === 0 || line2[s-1] === 0) {console.log('NO'); return}

    for (let i=s-1; i<n ; i++){
        if (line1[i] === 1 && line2[i] === 1)  {console.log('YES'); return}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=parseInt(line0[0]);
    let s=parseInt(line0[1]);

    if (line1[0] === '0') {console.log('NO'); return ;}

    for (let i=s-1; i<n ; i++){

        if (line1[i] === '1' && line2[i] === '1')  {console.log('YES'); return ;}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=parseInt(line0[0]);
    let s=parseInt(line0[1]);

    if (line1[0] === '0') {console.log('NO'); return ;}
    if (line1[s-1] === '1') {console.log('YES');return;}
    for (let i=s-1; i<n ; i++){

        if (line1[i] === '1' && line2[i] === '1')  {console.log('YES'); return ;}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=line0[0];
    let s=line0[1];

    if ((line1[0] === 0) || (line2[s-1] === 0)) {console.log('NO'); return}

    for (let i=s-1; i<n ; i++){
        if ((line1[i] === 1) && (line2[i] === 1))  {console.log('YES'); return}
    }

    console.log('NO');

}

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

function main (lines) {
    let line0= lines[0].split(' ');
    let line1= lines[1].split(' ');
    let line2= lines[2].split(' ');
    let n=line0[0];
    let s=line0[1];
    //console.log(n,s);
    if ((line1[0] === 0) || (line2[s-1] === 0)) {console.log('NO'); return}

    for (let i=s-1; i<n ; i++){
        console.log(line1[i],line2[i]);
        if ((line1[i] === 1) && (line2[i] === 1))  {console.log('YES'); return}
    }

    console.log('NO');

}


You are given $$$n$$$ words, each of which consists of lowercase alphabet letters. Each word contains at least one vowel. You are going to choose some of the given words and make as many beautiful lyrics as possible.Each lyric consists of two lines. Each line consists of two words separated by whitespace. A lyric is beautiful if and only if it satisfies all conditions below.   The number of vowels in the first word of the first line is the same as the number of vowels in the first word of the second line.  The number of vowels in the second word of the first line is the same as the number of vowels in the second word of the second line.  The last vowel of the first line is the same as the last vowel of the second line. Note that there may be consonants after the vowel. Also, letters "a", "e", "o", "i", and "u" are vowels. Note that "y" is never vowel.For example of a beautiful lyric,  "hello hellooowww" "whatsup yowowowow"  is a beautiful lyric because there are two vowels each in "hello" and "whatsup", four vowels each in "hellooowww" and "yowowowow" (keep in mind that "y" is not a vowel), and the last vowel of each line is "o".For example of a not beautiful lyric,  "hey man""iam mcdic"  is not a beautiful lyric because "hey" and "iam" don't have same number of vowels and the last vowels of two lines are different ("a" in the first and "i" in the second).How many beautiful lyrics can you write from given words? Note that you cannot use a word more times than it is given to you. For example, if a word is given three times, you can use it at most three times.

The first line contains single integer $$$n$$$ ($$$1 \le n \le 10^{5}$$$) — the number of words. The $$$i$$$-th of the next $$$n$$$ lines contains string $$$s_{i}$$$ consisting lowercase alphabet letters — the $$$i$$$-th word. It is guaranteed that the sum of the total word length is equal or less than $$$10^{6}$$$. Each word contains at least one vowel.

In the first line, print $$$m$$$ — the number of maximum possible beautiful lyrics. In next $$$2m$$$ lines, print $$$m$$$ beautiful lyrics (two lines per lyric). If there are multiple answers, print any.

14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that

7
arsijo
suggested
the
idea
for
this
problem

3
about proud
hooray round
wow first
this is
i that
mcdics am

NoteIn the first example, those beautiful lyrics are one of the possible answers. Let's look at the first lyric on the sample output of the first example. "about proud hooray round" forms a beautiful lyric because "about" and "hooray" have same number of vowels, "proud" and "round" have same number of vowels, and both lines have same last vowel. On the other hand, you cannot form any beautiful lyric with the word "codeforces".In the second example, you cannot form any beautiful lyric from given words.In the third example, you can use the word "same" up to three times.

var n = +readline();

function calc() {
    if (n < 4) {
        return [];
    }

    var result = [];
    var second = [];
    var first = [];
    var words = {};

    var vowels = /[aoiue]/g;
    function count(str) {
        var r = str.match(vowels);

        return r;
    }

    for (var i = 0; i < n; i++) {
        var input = readline();
        var r = input.match(vowels);
        var count = r.length;
        var last = r[count - 1];

        if (!words[count]) {
            words[count] = {
                array: []
            };
        }

        var hm = words[count];

        if (!hm[last]) {
            hm[last] = [input];
            hm.array.push(input);
        } else {
            var uniq = true;
            for (var j = 0; j < hm[last].length; j++) {
                var v = hm[last][j];
                second.push([input, v]);
                hm[last].splice(j, 1);
                hm.array.splice(hm.array.indexOf(v), 1);
                uniq = false;
                break;
            }

            if (uniq) {
                hm[last].push(input);
                hm.array.push(input);
            }
        }
    }

    for (var vow in words) {
        var arr = words[vow].array;

        for (var j = 0; j < arr.length - 1; j = j + 2) {
            first.push([arr[j], arr[j + 1]]);
        }
    }

    while (second.length >= 1 && (second.length + first.length) > 1) {
        var fp = null;
        if (first.length) {
            fp = first.pop();
        } else {
            fp = second.pop();
        }

        var sp = second.pop();

        result.push(fp[0] + ' ' + sp[0] + '\n' + fp[1] + ' ' + sp[1]);
    }

    return result;
}

var r = calc();
write(r.length);
if (r.length) {
    write('\n');
    write(r.join('\n'));
}

var g = Number(readline());

var k = "";
var obj = {};
var obj2 = {};

var words = {};

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

	k = readline();
	obj = {};
	obj.str = k;
	obj.count = 0;

	k = k.split("");

	for(l=0;l<k.length;l++){
		if(k[l] == "a" || k[l] == "e" || k[l] == "o" || k[l] == "i" || k[l] == "u"){
			obj.last = k[l];
			obj.count++;
		}
	}

	if(!words.hasOwnProperty(obj.count))
	    words[obj.count] = {};

    if(!Array.isArray(words[obj.count][obj.last]))
        words[obj.count][obj.last] = [];

    words[obj.count][obj.last].push(obj.str);

}

var comp_duos = [];
var semi_comp_duos = [];

for(key in words){

    var cont = words[key];

    for(syl in cont){

        while(cont[syl].length >= 2){
            var first = cont[syl].pop();
            var second = cont[syl].pop();

            comp_duos.push([first, second]);
        }
    }

    var semi_comp = [];

    for(syl in cont){
        for(i=0;i<cont[syl].length;i++){
            semi_comp.push(cont[syl][i]);
        }

        cont[syl] = [];
    }

    while(semi_comp.length >= 2){
        var first = semi_comp.pop();
        var second = semi_comp.pop();

        semi_comp_duos.push([first, second]);
    }

}

var lyrics = [];

while(comp_duos.length != 0 && semi_comp_duos.length != 0){

    var semi_comp_duo = semi_comp_duos.pop();
    var comp_duo = comp_duos.pop();

    lyrics.push([semi_comp_duo[0], comp_duo[0]]);
    lyrics.push([semi_comp_duo[1], comp_duo[1]]);
}

while(comp_duos.length >= 2){
    var comp_duo1 = comp_duos.pop();
    var comp_duo2 = comp_duos.pop();

    lyrics.push([comp_duo1[0], comp_duo2[0]]);
    lyrics.push([comp_duo1[1], comp_duo2[1]]);
}

print(lyrics.length/2);
for(i= 0;i<lyrics.length;i++){
    var lyr = lyrics[i];

    print(lyr[0] + " " + lyr[1]);
}

var n = +readline();

function calc() {
    if (n < 4) {
        return [];
    }

    var result = [];
    var second = [];
    var first = [];
    var words = {};

    var vowels = /[aoiue]/g;
    function count(str) {
        var r = str.match(vowels);

        return r;
    }

    for (var i = 0; i < n; i++) {
        var input = readline();
        var r = input.match(vowels);
        var count = r.length;
        var last = r[count - 1];

        if (!words[count]) {
            words[count] = {
                array: []
            };
        }

        var hm = words[count];

        if (!hm[last]) {
            hm[last] = [input];
            hm.array.push(input);
        } else {
            var uniq = true;
            for (var j = 0; j < hm[last].length; j++) {
                var v = hm[last][j];
                if (input !== v) {
                    second.push([input, v]);
                    hm[last].splice(j, 1);
                    hm.array.splice(hm.array.indexOf(v), 1);
                    uniq = false;
                    break;
                }
            }

            if (uniq) {
                hm[last].push(input);
                hm.array.push(input);
            }
        }
    }

    for (var vow in words) {
        var arr = words[vow].array;

        for (var j = 0; j < arr.length - 1; j = j + 2) {
            first.push([arr[j], arr[j + 1]]);
        }
    }

    while (second.length >= 1 && (second.length + first.length) > 1) {
        var fp = null;
        if (first.length) {
            fp = first.pop();
        } else {
            fp = second.pop();
        }

        var sp = second.pop();

        result.push(fp[0] + ' ' + sp[0] + '\n' + fp[1] + ' ' + sp[1]);
    }

    return result;
}

var r = calc();
write(r.length);
if (r.length) {
    write('\n');
    write(r.join('\n'));
}

var n = +readline();

function calc() {
    if (n < 4) {
        return [];
    }

    var result = [];
    var second = [];
    var first = [];
    var words = {};

    var vowels = /[aoiue]/g;
    function count(str) {
        var r = str.match(vowels);

        return r;
    }

    for (var i = 0; i < n; i++) {
        var input = readline();
        var r = input.match(vowels);
        var count = r.length;
        var last = r[count - 1];

        if (!words[count]) {
            words[count] = {
                array: []
            };
        }

        var hm = words[count];

        if (!hm[last]) {
            hm[last] = [input];
            hm.array.push(input);
        } else {
            var uniq = true;
            for (var j = 0; j < hm[last].length; j++) {
                var v = hm[last][j];
                if (input !== v) {
                    second.push([input, v]);
                    hm[last].splice(j, 1);
                    hm.array.splice(hm.array.indexOf(v), 1);
                    uniq = false;
                    break;
                }
            }

            if (uniq) {
                hm[last].push(input);
                hm.array.push(input);
            }
        }
    }

    for (var vow in words) {
        var arr = words[vow].array;

        for (var j = 0; j < arr.length - 1; j = j + 2) {
            first.push([arr[j], arr[j + 1]]);
        }
    }

    while (second.length >= 1 && (second.length + first.length) > 1) {
        var fp = null;
        if (first.length) {
            fp = first.pop();
        } else {
            fp = second.pop();
        }

        var sp = second.pop();

        result.push(fp[0] + ' ' + sp[0] + '\n' + fp[1] + ' ' + sp[1]);
    }

    return result;
}

var r = calc();
write(r.length);
write(r.join('\n'));