A boy Bob likes to draw. Not long ago he bought a rectangular graph (checked) sheet with n rows and m columns. Bob shaded some of the squares on the sheet. Having seen his masterpiece, he decided to share it with his elder brother, who lives in Flatland. Now Bob has to send his picture by post, but because of the world economic crisis and high oil prices, he wants to send his creation, but to spend as little money as possible. For each sent square of paper (no matter whether it is shaded or not) Bob has to pay 3.14 burles. Please, help Bob cut out of his masterpiece a rectangle of the minimum cost, that will contain all the shaded squares. The rectangle's sides should be parallel to the sheet's sides.

The first line of the input data contains numbers n and m (1 ≤ n, m ≤ 50), n — amount of lines, and m — amount of columns on Bob's sheet. The following n lines contain m characters each. Character «.» stands for a non-shaded square on the sheet, and «*» — for a shaded square. It is guaranteed that Bob has shaded at least one square.

Output the required rectangle of the minimum cost. Study the output data in the sample tests to understand the output format better.

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 rowNum = integers[0], colNum = integers[1];

	var grid = [];
	var rowDirty = new Array(rowNum), colDirty = new Array(colNum);
	for (var r = 0; r < rowNum; r += 1) {
		grid.push(trim(readline()));
		for (var c = 0; c < colNum; c += 1) {
			if (grid[r][c] == '*') {
				rowDirty[r] = true;
				colDirty[c] = true;
			}
		}
	}

	var rStart = 0, rEnd = rowNum-1;
	while (rowDirty[rStart] !== true) {
		rStart += 1;
	}
	while (rowDirty[rEnd] !== true) {
		rEnd -= 1;
	}

	var cStart = 0, cEnd = colNum-1;
	while (colDirty[cStart] !== true) {
		cStart += 1;
	}
	while (colDirty[cEnd] !== true) {
		cEnd -= 1;
	}

	for (var r = rStart; r <= rEnd; r += 1) {
		print(grid[r].substring(cStart, cEnd+1));
	}

}

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 rowNum = integers[0], colNum = integers[1];

	var rStart = rowNum-1, rEnd = 0;
	var cStart = colNum-1, cEnd = 0;
	var grid = [];

	for (var r = 0; r < rowNum; r += 1) {
		grid.push(trim(readline()));
		for (var c = 0; c < colNum; c += 1) {
			if (grid[r][c] == '*') {
				if (r < rStart) {
					rStart = r;
				}
				if (r > rEnd) {
					rEnd = r;
				}
				if (c < cStart) {
					cStart = c;
				}
				if (c > cEnd) {
					cEnd = c;
				}
			}
		}
	}

	for (var r = rStart; r <= rEnd; r += 1) {
		print(grid[r].substring(cStart, cEnd+1));
	}

}

main();

'use strict'

let lll = readline().split(' ')
const N = lll[0]
const M = lll[1]

let l = 0
let r = 0
let t = 0
let b = 0

let pct = []

while (lll = readline()) pct.push(lll.split(''))

while (t < N && !~pct[t].indexOf('*')) t++
while (b < N - t && !~pct[N - b - 1].indexOf('*')) b++
while (l < M && !~pct.map(ln => ln[l]).indexOf('*')) l++
while (r < M - l && !~pct.map(l => l[M - r - 1]).indexOf('*')) r++

print(pct.slice(t, N - b).map(ln => ln.slice(l, M - r)).map(l => l.join('')).join('\n'))

var data = readline().split(' ').map(item => parseInt(item));
var n = data[0], m = data[1];
data = [];
for(var i = 0; i < n; i++) {
  data.push(readline());
}
var m1, m2, n1, n2;
for(var i = 0; i < n; i++) {
  for(var j = 0; j < m; j++) {
    if(data[i][j] === '*') {
      n1 = i;
      break;
    }
  }
  if(n1 != undefined) {
    break;
  }
}
for(var i = n - 1; i >= 0; i--) {
  for(var j = 0; j < m; j++) {
    if(data[i][j] === '*') {
      n2 = i;
      break;
    }
  }
  if(n2 != undefined) {
    break;
  }
}
for(var i = 0; i < m; i++) {
  for(var j = 0; j < n; j++) {
    if(data[j][i] === '*') {
      m1 = i;
      break;
    }
  }
  if(m1 != undefined) {
    break;
  }
}
for(var i = m - 1; i >= 0; i--) {
  for(var j = 0; j < n; j++) {
    if(data[j][i] === '*') {
      m2 = i;
      break;
    }
  }
  if(m2 != undefined) {
    break;
  }
}
for(var i = n1; i <= n2; i++) {
  print(data[i].substr(m1, m2 - m1 + 1));
}

parameters = readline().split(" ").map(Number)
lines = []

xStart = parameters[1] - 1
xEnd = 0

yStart = parameters[0] - 1
yEnd = 0

for (row = 0; row < parameters[0]; row++) {
    lines[row] = readline()
    for (col = 0; col < parameters[1]; col++) {
        if (lines[row][col] == "*") {
            if (col < xStart) xStart = col
            if (col > xEnd) xEnd = col
            if (row < yStart) yStart = row
            if (row > yEnd) yEnd = row
        }
    }
}

for (row = yStart; row < yEnd + 1; row++) {
    ans = ''
    for (col = xStart; col < xEnd + 1; col++) {
        ans += lines[row][col]
    }
    print(ans)
}

var nm = readline().split(' ').map(Number);
var n = nm[0];
var m = nm[1];
var l = [];
var x1 = m-1;
var x2 = 0;
var y1 = n-1;
var y2 = 0;
for (var i=0; i<n; i++){
	l[i] = readline();
	for (var j=0; j<m; j++){
		if (l[i][j] == '*') {
			if (j < x1) x1 = j;
			if (j > x2) x2 = j;
			if (i < y1) y1 = i;
			if (i > y2) y2 = i;
		};
	}
}
for (var i=y1; i<=y2; i++){
	var ans = '';
	for (var j=x1; j<=x2; j++){
		ans += l[i][j];
	}
	print(ans);
}

const readline = require('readline');

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

var top = -1, bottom, left = 50, right = 0, rows, collumns, indicator = 0, cont = [], ri = 0;
rl.on('line', (input) => {
    if (indicator == 0) {
        let temp = input.split(' ').map(item => parseInt(item));
        rows = temp[0];
        collumns = temp[1];
        indicator++;
    }
    else {
        let fIndex = input.indexOf('*');
        if (fIndex != -1) {
            if (top == -1)
                top = ri;
            if (left > fIndex)
                left = fIndex;
            let lIndex = input.lastIndexOf('*');
            if (right < lIndex)
                right = lIndex;
            bottom = ri;

        }
        /** */
         // console.log("inside else input = %s ",input);
        /** */
        cont.push(input);

        ri++;// increase row index
    }
}).on('close', () => {
    //
    //console.log("top = %d  bottom = %d  left = %d  right = %d",top,bottom,left,right);
    //
    for (let i = top; i <= bottom; i++)
       console.log(cont[i].substring(left, right + 1));
       //console.log(cont[i]);
});

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

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

  arr.push(d.split(''));

  c++;
});

rl.on('close', () => {
  let minX = Infinity;
  let maxX = -Infinity;
  let minY = Infinity;
  let maxY = -Infinity;

  for (let i = 0; i < arr.length; i++) {
    for (let j = 0; j < arr[i].length; j++) {
      if (arr[i][j] === '*') {
        minX = Math.min(minX, j);
        maxX = Math.max(maxX, j);
        minY = Math.min(minY, i);
        maxY = Math.max(maxY, i);
      }
    }
  }

  let ans = '';

  for (let i = minY; i <= maxY; i++) {
    for (let j = minX; j <= maxX; j++) {
      ans += arr[i][j];
    }

    ans += '\n';
  }

  console.log(ans);
});

const readline = require("readline");

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

var array = [];
var n = -1;
var left = 50;
var top = 50;
var right = 0;
var down = 0;
var check = true;
rl.on("line", input => {
  if (n == -1) {
    n++;
  } else {
    array.push(input);

    for (var i = 0; i < input.length; i++) {
      if (input[i] == "*") {
        if (check) {
          top = n;
          check = false;
        }
        if (i < left) {
          left = i;
        }

        if (i > right) {
          right = i;
        }
        down = n;
      }
    }
    n++;
  }
}).on("close", () => {
  for (var i = top; i <= down; i++) {
    console.log(array[i].substr(left, right - left + 1));
  }
});


Polycarp has three sisters: Alice, Barbara, and Cerene. They're collecting coins. Currently, Alice has $$$a$$$ coins, Barbara has $$$b$$$ coins and Cerene has $$$c$$$ coins. Recently Polycarp has returned from the trip around the world and brought $$$n$$$ coins.He wants to distribute all these $$$n$$$ coins between his sisters in such a way that the number of coins Alice has is equal to the number of coins Barbara has and is equal to the number of coins Cerene has. In other words, if Polycarp gives $$$A$$$ coins to Alice, $$$B$$$ coins to Barbara and $$$C$$$ coins to Cerene ($$$A+B+C=n$$$), then $$$a + A = b + B = c + C$$$.Note that A, B or C (the number of coins Polycarp gives to Alice, Barbara and Cerene correspondingly) can be 0.Your task is to find out if it is possible to distribute all $$$n$$$ coins between sisters in a way described above.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given on a new line and consists of four space-separated integers $$$a, b, c$$$ and $$$n$$$ ($$$1 \le a, b, c, n \le 10^8$$$) — the number of coins Alice has, the number of coins Barbara has, the number of coins Cerene has and the number of coins Polycarp has.

For each test case, print "YES" if Polycarp can distribute all $$$n$$$ coins between his sisters and "NO" otherwise.

'use strict'

const problem = (a, b, c, n) => (x => (x < 0 || x % 3) ? 'NO' : 'YES')(a + b + c + n - 3 * Math.max(a, b, c));
let q = +readline();
while(q--) print(problem(...readline().split(' ').map(Number)))

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var abcd = readline().split(' ').map(Number);
    var a = abcd[0];
    var b = abcd[1];
    var c = abcd[2];
    var d = abcd[3];
    var max = Math.max(a, b, c);
    var dif = max * 3 - a - b - c;
    var res = (d - dif >= 0) && (d - dif) % 3 === 0
    print(res ? 'YES' : 'NO')
  }
}

main()

'use strict';
var t = readline();
while(t--) {
    var a = readline().split(" ").map(function(num) {
        return parseInt(num);
    });
    var sum = a.reduce(function(total, num) {
        return total + num;
    }, 0);
    if(sum % 3) {
        print("NO");
    } else {
        var x = sum / 3;
        if(x-a[0] >=0 && x-a[1] >=0 && x-a[2] >= 0) {
            print("YES");
        } else {
            print("NO");
        }
    }

}

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

for(var i=1; i<=t; i++) {
    var inp = readline().split(' ');
    var n = parseInt(inp.pop(), 10);

    for(var j=0; j<3; j++) {
        inp[j] = parseInt(inp[j], 10);
    }

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

    if((inp[0] - inp[1]) + (inp[0] - inp[2]) > n) {
        print('NO');
    } else if((inp[0] - inp[1]) + (inp[0] - inp[2]) === n) {
        print('YES');
    } else {
        n -= (inp[0] - inp[1]) + (inp[0] - inp[2]);

        if(n%3 === 0) print('YES');
        else print('NO');
    }
}

var T = parseInt(readline(), 10);

for(var t=1; t<=T; t++) {
	var A = readline().split(' ').map(Number);
	var n = A.pop();

	A.sort((a,b)=> {return a-b;});

	var need = A[2]-A[0] + A[2]-A[1];
	if(need > n) print('NO');
	else {
		n -= need;
		if(n%3==0) print('YES');
		else print('NO');
	}
}

function main(input) {
    var arr = input.split("\n");
    var t = arr[0]
    for(var i = 0; i < t; i++) {

        var s = arr[i + 1].split(" ")
        a = parseInt(s[0])
        b = parseInt(s[1])
        c = parseInt(s[2])
        n = parseInt(s[3])

        f = Math.max(a, Math.max(b, c))
        d = (f - a) + (f - b) + (f - c)

        if (n < d) {
            process.stdout.write("NO\n")
            continue;
        } else {
            n -= d;
            if ((n % 3) === 0) {
                process.stdout.write("YES\n")
                continue;
            } else {
                process.stdout.write("NO\n")
            }
        }
    }
}

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

process.stdin.on("data", function (input) {
    stdin_input += input;
});

process.stdin.on("end", function () {
   main(stdin_input);
});

// Sample code to perform I/O:

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

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

function main(input) {
    let output = nameLookUp(input);
    //process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();
    for (let index = 1; index <= t; index++) {
        const element = inputs[index].trim().split(' ');
        let n = element[3];
        let coins = strToNumArr(element.slice(0, 3).sort((a, b) => b - a));
        n -= ((2 * coins[0]) - coins[1] - coins[2]);
        if (n < 0 || n % 3 != 0) {
            console.log('NO');
        } else {
            console.log('YES');
        }
    }

}

'use strict';

let inputString = '', currentLine = 0, inputLine = [];

const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout });
rl.on('line', line => { inputLine.push(line); });
rl.on('close', () =>{ main(inputLine); } );

function readALine() { return inputLine[currentLine++]; }
function printALine(str) { console.log(str); }

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver < 0 ) return "NO";
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputLine = inLines;

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

module.exports.main = main;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
function asArrayNumber(testCase) {
    return testCase.split(' ').map((x) => {
        return parseInt(x, 10);
    });
}
function findGreatest(sisters) {
    return Math.max(...sisters);
}
function calculateDifference(greatest, sisters) {
    let difference = 0;
    for (let i = 0; i < sisters.length; i++) {
        difference = greatest - sisters[i] + difference;
    }
    return difference;
}
function solve(lines) {
    const testCases = lines.slice(1);
    for (let i = 0; i < testCases.length; i++) {
        const numbers = asArrayNumber(testCases[i]);
        const sisters = [numbers[0], numbers[1], numbers[2]];
        const n = numbers[3];
        const greatest = findGreatest(sisters);
        const difference = calculateDifference(greatest, sisters);
        const remainder = n - difference;
        if (remainder >= 0 && remainder % 3 === 0) {
            console.log('YES');
        }
        else {
            console.log('NO');
        }
    }
}
function main() {
    const stdinBuffer = fs_1.default.readFileSync(0);
    const lines = stdinBuffer
        .toString()
        .split('\n')
        .filter((x) => x !== '');
    solve(lines);
}
main();

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

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

process.stdin.on('end', () => {
  arr = arr.split('\n').map(a => a.replace(/(\r\n|\n|\r)/gm, ''))
  main(arr)
})

function wr(...x) {
  console.log(...x)
}

function sort(a, inc = true) {
  if(inc) a.sort((a, b) => a - b)
  else a.sort((a, b) => b - a)
}

function readInt(a, i) {
  if(i === undefined) return parseInt(a.shift())
  else return parseInt(a[i])
}

function readInts(a, i) {
  if(i === undefined) return arr.shift().split(' ').map(a => parseInt(a))
  else return arr[i].split(' ').map(a => parseInt(a))
}

function main(input) {
  let i = 0
  const t = readInt(input, i++)

  for(let j = 0; j < t; j++) {
    const as = readInts(input, i++)
    let n = as[3]
    const ax = [as[0], as[1], as[2]]
    sort(ax)

    n -= ax[2] - ax[1]
    n -= ax[2] - ax[0]
    if(n < 0 || n % 3 !== 0) wr('NO')
    else wr('YES')

  }
}

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

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

  const arr = d.split(' ').map(Number);
  let coins = arr.pop();
  const max = Math.max(...arr);

  for (let i = 0; i < arr.length; i++) {
    if (arr[i] < max) {
      coins -= (max - arr[i]);
    }
  }

  if (coins < 0) {
    console.log('NO');
  }
  else if (coins % 3 !== 0) {
    console.log('NO');
  }
  else {
    console.log('YES');
  }

  c++;
});

'use strict';

const { createInterface } = require('readline');

const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
})
const lines = [];
let nextLine = 0;
rl.on('line', (line) => {
  lines.push(line);
});

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

function readline() {
  return lines[nextLine++];
}

function solve(a, b, c, n) {
  const sum = a + b + c + n;
  if (sum % 3 !== 0) {
    return false;
  }
  const result = sum / 3;
  return (a <= result && b <= result && c <= result);
}

function main() {
  const t = parseInt(readline());
  for(let i = 0; i < t; i++) {
    const [a, b, c, n] = readline().split(' ').map(Number);
    const res = solve(a, b, c, n);
    console.log(res ? 'YES': 'NO');
  }
}

'use strict'

const problem = (a, b, c, n) => (a + b + c + n - 3 * Math.max(a, b, c)) % 3 ? 'NO' : 'YES';
let q = +readline();
while(q--) print(problem(...readline().split(' ').map(Number)))

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var abcd = readline().split(' ').map(Number);
    var a = abcd[0];
    var b = abcd[1];
    var c = abcd[2];
    var d = abcd[3];
    var ca = c - a;
    var cb = c - b;
    var res = (d - ca - cb > 0) && (d - ca - cb) % 3 === 0
    print(res ? 'YES' : 'NO')
  }
}
main();

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var abcd = readline().split(' ').map(Number);
    var a = abcd[0];
    var b = abcd[1];
    var c = abcd[2];
    var d = abcd[3];
    var ca = c - a;
    var cb = c - b;
    var res = (d - ca - cb >= 0) && (d - ca - cb) % 3 === 0
    print(res ? 'YES' : 'NO')
  }
}
main();

'use strict';
var t = readline();
while(t--) {
    var a = readline().split(" ").map(function(num) {
        return parseInt(num);
    }).reduce(function(total, num) {
        return total + num;
    }, 0);
    print(((a % 3) ? "NO" : "YES") + "\n");

}

var num_tests = readline();
var coins = [];
for(var i=0;i<num_tests;i++){
	coins.push(readline().split(' '));
}
for(var i=0;i<coins.length;i++){
	var j = coins[i];
	var soma = j[0]+j[1]+j[2]+j[3];
  if(soma%3 > 0 || soma%3 < 0){
    print('NO');
  }else{
  	print('YES');
  }
}

var num_tests = readline();
var coins = [];
for(var i=0;i<num_tests;i++){
	coins.push(readline());
}
for(var i=0;i<coins.length;i++){
	var j = coins[i];
	var soma = j[0]+j[1]+j[2]+j[3];
  if(soma%3 > 0 || soma%3 < 0){
    print('NO');
  }else{
  	print('YES');
  }
}

var t = readline();
while(t--){
	var j = readline().split(' ').map(Number);
	var soma = j[0]+j[1]+j[2]+j[3];
	var d1,d2
	if(j[2]>j[1]){
	    d1 = Math.abs(j[2]-j[1]);
	    d2 = Math.abs(j[2]-j[0]);
	}else{
	    d1 = Math.abs(j[1]-j[2]);
	    d2 = Math.abs(j[1]-j[0]);
	}
	var dt = d1+d2;
	if(j[3]>=dt){
	    soma -= dt;
	    if(soma%3 > 0 || soma%3 < 0){
            print('NO');
        }else{
  	        print('YES');
        }
	}else{
	    print('NO');
	}
}

var t = readline();
while(t--){
	var j = readline().split(' ');
	var soma = j[0]+j[1]+j[2]+j[3];
	var d1,d2
	if(j[2]>j[1]){
	    d1 = Math.abs(j[2]-j[1]);
	    d2 = Math.abs(j[2]-j[0]);
	}else{
	    d1 = Math.abs(j[1]-j[2]);
	    d2 = Math.abs(j[1]-j[0]);
	}
	var dt = d1+d2;
	if(j[3]>=dt){
	    if(soma%3 > 0 || soma%3 < 0){
            print('NO');
        }else{
  	        print('YES');
        }
	}else{
	    print('NO');
	}
}

var num_tests = readline();
var coins = [];
for(var i=0;i<num_tests;i++){
	coins.push(readline());
}
for(var i=0;i<coins.length;i++){
	var j = coins[i];
	var soma = j[0]+j[1]+j[2]+j[3];
  soma = soma%3;
  if(soma !== 0){
    print('NO');
  }else{
  	print('YES');
  }
}

var t = readline();
while(t--){
	var j = readline().split(' ').map(Number);
	var soma = j[0]+j[1]+j[2]+j[3];
	var d1,d2
	if(j[2]>j[1]){
	    d1 = Math.abs(j[2]-j[1]);
	    d2 = Math.abs(j[2]-j[0]);
	}else{
	    d1 = Math.abs(j[1]-j[2]);
	    d2 = Math.abs(j[1]-j[0]);
	}
	var dt = d1+d2;
	if(j[3]>=dt){
	    if(soma%3 > 0 || soma%3 < 0){
            print('NO');
        }else{
  	        print('YES');
        }
	}else{
	    print('NO');
	}
}

var num_tests = readline();
var coins = [];
for(var i=0;i<num_tests;i++){
	coins.push(readline().split(' '));
}
for(var i=0;i<coins.length;i++){
	var j = coins[i];
	var soma = j[0]+j[1]+j[2]+j[3];
	var d1,d2
	if(j[2]>j[1]){
	    d1 = Math.abs(j[2]-j[1]);
	    d2 = Math.abs(j[2]-j[0]);
	}else{
	    d1 = Math.abs(j[1]-j[2]);
	    d2 = Math.abs(j[1]-j[0]);
	}
	var dt = d1+d2;
	if(j[3]>=dt){
	    if(soma%3 > 0 || soma%3 < 0){
            print('NO');
        }else{
  	        print('YES');
        }
	}else{
	    print('NO');
	}
}

var num_tests = readline();
var coins = [];
for(var i=0;i<num_tests;i++){
	print(readline());
}

var num_tests = readline();
var coins = [];
for(var i=0;i<num_tests;i++){
	coins.push(readline());
}
for(var i=0;i<coins.length;i++){
	var j = coins[i];
	var soma = j[0]+j[1]+j[2]+j[3];
  if(soma%3){
    print('NO');
  }else{
  	print('YES');
  }
}

// Sample code to perform I/O:

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

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

function main(input) {
    let output = nameLookUp(input);
    //process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();
    for (let index = 1; index <= t; index++) {
        const element = inputs[index].trim().split(' ');
        let n = element[3];
        let coins = strToNumArr(element.slice(0, 3).sort((a, b) => b - a));
        if (n > 0 && (n - ((2 * coins[0]) - coins[1] - coins[2])) % 3 === 0) {
            console.log('YES');
        }
        else {
            console.log('NO');
        }
    }

}

// Sample code to perform I/O:

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

process.stdin.on("data", function (input) {
    stdin_input += input;                               // Reading input from STDIN
});

process.stdin.on("end", function () {
    main(stdin_input);
});

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

function main(input) {
    let output = nameLookUp(input);
    //process.stdout.write(output);       // Writing output to STDOUT
}

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail

// Write your code here
function nameLookUp(str) {

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();
    for (let index = 1; index <= t; index++) {
        const element = inputs[index].trim().split(' ');
        let n = element[3];
        let coins = strToNumArr(element.slice(0, 3).sort((a, b) => b - a));
        if ((n - ((2 * coins[0]) - coins[1] - coins[2])) % 3 === 0) {
            console.log('YES');
        }
        else {
            console.log('NO');
        }
    }

}

var inputLines = null;

function readALine() {
    if( inputLines ) { return inputLines.shift(); }
    return readline();
}

function printALine(str) {
    console.log(str);
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputLines = inLines;

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

module.exports = { main: main, inputLines: inputLines };

'use strict';

let inputString = '', currentLine = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', inputStdin => { inputString += inputStdin; });
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    console.log("CALL MAIN");
    main();
});

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

function printALine(str) {
    console.log(str);
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputString = (inLines ? inLines : []);

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

// module.exports.main = main;

'use strict';

let inputString = '', currentLine = 0, inputLine = [];

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', inputStdin => { inputString += inputStdin; });
process.stdin.on('end', _ => {
    var arr = inputString.trim().split('\n').map(str => {
        return str.trim();
    });
    main(arr);
});

function readALine() {
    return inputLine[currentLine++];
}

function printALine(str) {
    console.log(str);
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputLine = inLines;

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

// module.exports.main = main;

var inputLines = null;

function readALine() {
    if( inputLines ) { return inputLines.shift(); }
    return readline();
}

function printALine(str) {
    console.log(str);
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputLines = inLines;

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

//module.exports = { main: main, inputLines: inputLines };

'use strict';

let inputString = '', currentLine = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', inputStdin => { inputString += inputStdin; });
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    console.log("Inputstring" + inputString);
    main();
});

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

function printALine(str) {
    console.log(str);
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputString = (inLines ? inLines : []);

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

// module.exports.main = main;

'use strict';

let inputString = '', currentLine = 0;

process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', inputStdin => { inputString += inputStdin; });
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});

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

function printALine(str) {
    console.log(str);
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputString = (inLines ? inLines : []);

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

module.exports.main = main;

let inputLines = [];
const printALine = console.log
const rl = require('readline').createInterface({ input: process.stdin, output: process.stdout })
rl.on('line', line => { inputLines.push(line); });
rl.on('close', main);
let rlindex = 0;
function readALine() {
    return inputLines[rlindex++];
}

// ======================================================
// A. Collecting Coins
// https://codeforces.com/problemset/problem/1294/A
// ======================================================

function stringArrayToNumbers(str) {
    return str.split(' ').map(Number);
}

function doIt( a, b, c, n ) {
    var max = Math.max(a, b, c);
    var coinToGive = 3*max - (a + b + c);
    var leftOver = n - coinToGive;
    if( leftOver % 3 == 0 ) return "YES";
    return "NO";
}

function main( inLines ) {

    inputLines = inLines ? inLines : [];

    var numOfTests = parseInt(readALine());
    for( var i = 0; i < numOfTests; i++ ) {
        var string1 = readALine();
        var arr = stringArrayToNumbers(string1);
        var result = doIt(arr[0], arr[1], arr[2], arr[3]);
        printALine(result);
    }

}

module.exports.main = main;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
function asArrayNumber(testCase) {
    return testCase.split(' ').map((x) => {
        return parseInt(x, 10);
    });
}
function findGreatest(sisters) {
    return Math.max(...sisters);
}
function calculateDifference(greatest, sisters) {
    let difference = 0;
    for (let i = 0; i < sisters.length; i++) {
        difference = greatest - sisters[i] + difference;
    }
    return difference;
}
function solve(lines) {
    const testCases = lines.slice(1);
    // console.log('testCases', testCases)
    for (let i = 0; i < testCases.length; i++) {
        const numbers = asArrayNumber(testCases[i]);
        const sisters = [numbers[0], numbers[1], numbers[2]];
        const n = numbers[3];
        // console.log('sisters, n', sisters, n)
        const greatest = findGreatest(sisters);
        const difference = calculateDifference(greatest, sisters);
        const remainder = n - difference;
        if (remainder > 0 && remainder % 3 === 0) {
            console.log('YES');
        }
        else {
            console.log('NO');
        }
    }
}
function main() {
    const stdinBuffer = fs_1.default.readFileSync(0);
    const lines = stdinBuffer
        .toString()
        .split('\n')
        .filter((x) => x !== '');
    solve(lines);
}
main();

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

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

  if (d.split(' ').map(Number).reduce((x, y) => x + y, 0) % 3 === 0) {
    console.log('YES');
  }
  else {
    console.log('NO');
  }

  c++;
});

'use strict';

const { createInterface } = require('readline');

const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
})
const lines = [];
let nextLine = 0;
rl.on('line', (line) => {
  lines.push(line);
});

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

function readline() {
  return lines[nextLine++];
}

function solve(a, b, c, n) {
  const sum = a + b + c + n;
  return (sum % 3 === 0) ? 'YES' : 'NO';
}

function main() {
  const t = parseInt(readline());
  for(let i = 0; i < t; i++) {
    const [a, b, c, n] = readline().split(' ');
    const res = solve(a, b, c, n);
    console.log(res);
  }
}

'use strict';

const { createInterface } = require('readline');

const rl = createInterface({
  input: process.stdin,
  crlfDelay: Infinity
})
const lines = [];
let nextLine = 0;
rl.on('line', (line) => {
  lines.push(line);
});

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

function readline() {
  return lines[nextLine++];
}

function solve(a, b, c, n) {
  const sum = a + b + c + n;
  if (sum % 3 !== 0) {
    return false;
  }
  const result = sum / 3;
  return (a <= result && b <= result && c <= result);
}

function main() {
  const t = parseInt(readline());
  for(let i = 0; i < t; i++) {
    const [a, b, c, n] = readline().split(' ');
    const res = solve(a, b, c, n);
    console.log(res ? 'YES': 'NO');
  }
}


You have integer $$$n$$$. Calculate how many ways are there to fully cover belt-like area of $$$4n-2$$$ triangles with diamond shapes. Diamond shape consists of two triangles. You can move, rotate or flip the shape, but you cannot scale it. $$$2$$$ coverings are different if some $$$2$$$ triangles are covered by the same diamond shape in one of them and by different diamond shapes in the other one.Please look at pictures below for better understanding.  On the left you can see the diamond shape you will use, and on the right you can see the area you want to fill. These are the figures of the area you want to fill for $$$n = 1, 2, 3, 4$$$. You have to answer $$$t$$$ independent test cases.

The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^{4}$$$) — the number of test cases. Each of the next $$$t$$$ lines contains a single integer $$$n$$$ ($$$1 \le n \le 10^{9}$$$).

For each test case, print the number of ways to fully cover belt-like area of $$$4n-2$$$ triangles using diamond shape. It can be shown that under given constraints this number of ways doesn't exceed $$$10^{18}$$$.

NoteIn the first test case, there are the following $$$2$$$ ways to fill the area:  In the second test case, there is a unique way to fill the area:

// Q: https://codeforces.com/contest/1339/problem/A

const readline = require('readline');

let input = [];

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

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

rl.on('close', () => {
	const test = parseInt(input[0]);
	for (let t=0; t < test; t++) {
		let n = parseInt(parseInt(input[t+1]));
		console.log(n);
	}
});

function solution(n) {
	let ans = Array(n+1).fill(0);
	ans[0] = 0;
	for (let i = 1; i < n+1; i++) {
		ans[i] = ans[i-1] + 1;
	}
	return ans[n];
}

// Q: https://codeforces.com/contest/1339/problem/A

const readline = require('readline');

let input = [];

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

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

rl.on('close', () => {
	const test = parseInt(input[0]);
	for (let t=0; t < test; t++) {
		let n = parseInt(input[t+1]);
		console.log(n);
	}
});

const readline = require('readline');

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

let first = true;
rl.on('line', (line) => {
    if (first) {
      first = false;
    } else {
      process.stdout.write(line  + '\n')
    }
})

let i = '';
let lines;
process.stdin.on('data', (c) => (i += c));
process.stdin.on('end', () => {
  const { EOL } = require('os');
  lines = i.split(EOL); /*your input text, split by lines*/
  main();
});

function solve(nums) {

}

function main() {
  let currentLine = 0;
  const readLine = (_) => lines[currentLine++].split(' ').map((val) => parseInt(val));

  const test = readLine()[0];
  for (let t = 1; t <= test; ++t) {
    const n = readLine()[0];
    console.log(n);
  }
}

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

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

  console.log(d);

  c++;
});

const readline = require("readline");

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

let arr = [];

rl.on("line", (line) => {
    arr.push(line);
}).on("close", () => {
    solve(arr);
    process.exit(0);
});

function solve(lines) {
    let row = 0;
    let t = +lines[row++];
    for(let i = 0; i < t; i++) {
        let n = +lines[row++];
        console.log(n);
    }
}

process.stdin.setEncoding("ascii");
var input = "";
process.stdin.on("data", data => input += data);
process.stdin.on("end", () => {
	var lines = input.split('\n');
	for (i = 1; i < lines.length; i++)
		process.stdout.write(lines[i]);
});

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

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

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let [a] = readLine().split(' ').map((val) => parseInt(val));
    console.log(a);
  }
  //process.stdout.write("hello: ");
}

var tests = parseInt(readline())
for(var t = 0; t < tests; t ++){ print(readline()) }

//=> function
// ES5
/*
var x = function (x, y) {
    return x * y;
}

// ES6
const x = (x, y) => x * y;
*/

var t = +readline();
while(t--)
{
    x = +readline();
    print(x);
}

var t = readline();

while (t--) {
  print(readline());
}

const n = Number(readline());
var inp ;
for(var i = 0; i < n; i++ ){
    inp = Number(readline());
    print(inp);
}

var t = parseInt(readline());

for (var i = 0; i < t; i++) {
    print(readline());
}

var input = readline();

for(var i=0;i<input;i++) {
    var val = parseInt(readline());
    print(val);
}

var tc = Number(readline())
while(tc--) {
    var n = Number(readline())
    print(n)
}

var tc = readline()
while(tc--) {
    var n = readline()
    print(n)
}

const readline = require('readline');

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

let first = true;
rl.on('line', (line) => {
    if (first) {
      first = false;
    } else {
      process.stdout.write(line)
    }
})

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

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

  console.log(+d);

  c++;
});

process.stdin.setEncoding('ascii');
var T = -1

process.stdin.on('data', function (data) {
  if (T < 0)
    T = parseInt(data);
  else {
    process.stdout.write(data);
    T--;
    if (T == 0)
      process.exit();
  }
});


You are given an array $$$a$$$ of length $$$n$$$, and an integer $$$x$$$. You can perform the following operation as many times as you would like (possibly zero): replace two adjacent elements of the array by their sum. For example, if the initial array was $$$[3, 6, 9]$$$, in a single operation one can replace the last two elements by their sum, yielding an array $$$[3, 15]$$$, or replace the first two elements to get an array $$$[9, 9]$$$. Note that the size of the array decreases after each operation.The beauty of an array $$$b=[b_1, \ldots, b_k]$$$ is defined as $$$\sum_{i=1}^k \left\lceil \frac{b_i}{x} \right\rceil$$$, which means that we divide each element by $$$x$$$, round it up to the nearest integer, and sum up the resulting values. For example, if $$$x = 3$$$, and the array is $$$[4, 11, 6]$$$, the beauty of the array is equal to $$$\left\lceil \frac{4}{3} \right\rceil + \left\lceil \frac{11}{3} \right\rceil + \left\lceil \frac{6}{3} \right\rceil = 2 + 4 + 2 = 8$$$.Please determine the minimum and the maximum beauty you can get by performing some operations on the original array.

The first input line contains a single integer $$$t$$$ — the number of test cases ($$$1 \le t \le 1000$$$). The first line of each test case contains two integers $$$n$$$ and $$$x$$$ ($$$1 \leq n \leq 10^5$$$, $$$1 \leq x \leq 10^9$$$). The next line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \leq a_i \leq 10^9$$$), the elements of the array $$$a$$$.  It is guaranteed that the sum of values of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case output two integers — the minimal and the maximal possible beauty.

NoteIn the first test case the beauty of the array does not change if we perform any operations.In the second example we can leave the array unchanged to attain the maximum beauty, and to get the minimum beauty one can replace two elements $$$4$$$ and $$$11$$$ with their sum, yielding an array $$$[6, 15]$$$, which has its beauty equal to $$$7$$$.

const solve = (n, x, a) => {
    let max = sum = 0;
    for (const item of a) {
        sum += item;
        max += Math.ceil(item / x);
    }
    let min = Math.ceil(sum / x);
    console.log(min, max);
};

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

main()

const solve = (n, x, a) => {
    let max = 0;
    let sum = a.reduce((x, y) => x + y);
    for (const item of a) {
        max += Math.ceil(item / x);
    }
    let min = Math.ceil(sum / x);
    console.log(min, max);
};

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

main()

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

String.prototype.parseInt = (e) => parseInt(e);

let meow=-1,n,x,t;
let sumall,sum2;

function foo(line) {
	if(meow==-1) { n=-1; x=-1; return meow=parseInt(line); }
	if(n==-1) {
		let t = line.split(' ');
		n = t[0]-0;
		x = t[1]-0;

		t=n;
		sumall=0;
		sum2=0;
		return;
	} else {
		let zz = line.split(' ');
		for(let i=0;i<zz.length;i++) {
			let val = zz[i]-0;
			"console.warn(val);"
			sumall+=val;
			sum2+=Math.floor((val+x-1)/x);
		}
			"console.warn('nx=',n,x);"
		if(0==0) { console.log(Math.floor((sumall+(x-1))/x),' ',sum2); }
		n=-1; x=-1;
	}
}

// multi line input
readline.on('line', line => foo(line));

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0, x = 0;
    for(i = 1; i <= t * 2; i++){
        var k = lines[i].split(' ').map(Number);
        if(i % 2 == 1){
            n = k[0], x = k[1];
        }else{
            var min = 0, max = 0, total = 0;
            for(j = 0; j < n; j++){
                total += k[j];
                max += Math.floor(k[j] / x);
                if(k[j] % x !== 0){
                    max++;
                }
            }
            min += Math.floor(total / x);
            if(total % x !== 0){
                min++;
            }
            console.log(min, max);
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    var n = 0, x = 0;
    for(i = 1; i <= t * 2; i++){
        var k = lines[i].split(' ').map(Number);
        if(i % 2 == 1){
            n = k[0], x = k[1];
        }else{
            var min = 0, max = 0, sum = 0;
            for(j = 0; j < n; j++){
                sum += k[j];
                max += Math.floor(k[j] / x);
                if(k[j] % x !== 0){
                    max++;
                }
            }
            min = Math.floor(sum / x);
            if(sum % x !== 0){
                min++;
            }
            console.log(min, max);
        }
    }
});

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

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

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

//-----------main fucntion-----------

function main() {
    var tc = parseInt(readline());
    while (tc--) {
        var ar = readline().split(" ").map(e => +e);
        var n = ar[0], x = ar[1];
        var sum = 0, maxB = 0;
        var a = readline().split(" ").map(e => +e).map(e=>{
           sum+=e;
           maxB+=Math.ceil(e/x);
        });
        var minB = Math.ceil(sum/x);
        console.log(minB + " " + maxB);
    }

}

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

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

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

//-----------main function-----------

function main() {

    var t = parseInt(readline());

while (t--) {
  var ar = readline().split(' ').map(n => parseInt(n));
  var arr = readline().split(' ').map(n => parseInt(n));

  var n = ar[0];
  var x = ar[1];

  var minimal, maximal;

  const beauty = (arrayInput, divisor) => {
    var result = 0;
    arrayInput.forEach(element => {
      result = result + Math.ceil(element / divisor);
    });

    return result;
  }

  minimal = beauty(arr, x);

  for (var i = arr.length - 1; i >= 1; i--) {
    arr[i - 1] = arr[i - 1] + arr[i];
    arr.pop();
  }

  maximal = beauty(arr, x);

  print(maximal + ' '+ minimal);

}

}

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

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

function main() {
	let t = +readLine();
	while (t--) {
		const [len, x] = readLine().split(' ').map(Number);
		let [sum, divSum] = [0, 0];
		readLine()
			.split(' ')
			.forEach((n) => {
				n = Number(n);
				sum += n;
				divSum += Math.ceil(n / x);
			});
		console.log(`${Math.ceil(sum / x)} ${divSum}`);
	}
}

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

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

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

		let mn = 0, mx = 0;
		for (let i = 0; i < n; i++) {
			mn += a[i];
			mx += Math.ceil(a[i]/x);
		}
		mn = Math.ceil(mn/x);

		console.log(mn, mx);
	}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

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

    // console.log(Number(x))
    // 1 1 7
    // 6 9, 15, 18
    Array(Number(x)).fill(1).map((t, i) => {
        var [n,xx] = readline().split(' ').map(x => Number(x));
        var sum = 0
        var sum2 = 0
        var array = readline().split(' ').map(x => {
            sum+=Number(x)
            sum2+=Math.ceil(Number(x)/xx)
            Number(x)
        });
        console.log(Math.ceil(sum/xx),  sum2)
        // console.log(sum2)

    })

}

const { EOL } = require('os');

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

function main() {
    const lines = input.trim().split(EOL).map(line => line.trim());
    for (let i = 1; i < lines.length - 1; i += 2) {
        let ints = lines[i].split(' ').map(Number);
        let arr =  lines[i+1].split(' ').map(Number);
        beauty(ints, arr);
    }
}

function beauty(ints, arr) {
    let [n, x] = ints;
    let max = b(arr, x);
    let min = b([arr.reduce((a, c) => a + c, 0)], x);
    console.log(min, max)
}

function b(arr, x) {
    return arr.reduce((a, c) => a + Math.ceil(c / x), 0);
}

let inputString = '';
let currentLine = 0;
process.stdin.on('data', (data) => {
    inputString += data;
})
process.stdin.on('end', function (){
    inputString = inputString
        .trim()
        .split('\n')
        .map((str) => str.trim());
    main();
})
function readLine(){
    return inputString[currentLine++];
}
function main(){
    let t = +readLine();
    while(t--){
        const [n, x] = readLine().split(' ').map(Number);
        let [mn, mx] = [0, 0];
        readLine()
            .split(' ')
            .forEach((val) => {
                val = Number(val);
                mn += val;
                mx += Math.ceil(val / x);
            });
        mn = Math.ceil(mn / x);
        console.log(`${mn} ${mx}`);
    }
}

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

    const t = parseInt(lines[0]);

    for (let i = 1; i <= t * 2; i += 2) {
        let split = lines[i].split(' ');
        const n = parseInt(split[0]);
        const x = parseInt(split[1]);

        const arr = lines[i + 1].split(' ').map(num => parseInt(num));
        solve(n, x, arr);
    }
});

function solve(n, x, arr) {
    let max = 0;
    let sum = 0;

    for (let i = 0; i < n; i++) {
        sum += arr[i];
        max += Math.ceil(arr[i] / x);
    }

    const min = Math.ceil(sum / x);

    console.log(min, max);
}

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

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var N = nextInt();
		var x = nextInt();
		var list = nextIntArray(N);
		var sum = 0;
		var max = 0;
		for(var j = 0; j < N; j++){
			sum += list[j];
			max += Math.ceil(list[j] / x);
		}
		myout(Math.ceil(sum / x) + " " + max);
	}
}

r = readline

for(k = r(); k--; ) {

    x = r().split(' ')[1]
    a = r().split(' ')
    ma = 0; mi = 0;
    a.map(a => {ma += Math.ceil(a/x); mi-=-a;})
    print(Math.ceil(mi/x)+" "+ma)
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;
  var min = 0;

  for (var k = 0, z = 0; k < n; k++, z += 2) {
    max += Math.ceil(a[k] / x);
    min += a[k];
  }

  print(Math.ceil(min / x), max);
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;
  var min = 0;

  for (var k = 0, z = 0; k < n; k++, z += 2) {
    max += Math.ceil(a[k] / x);
  }

  for (var z = 0; z < n; z += 2) {
    min += a[z] + (a[z+1] || 0);
  }

  print(Math.ceil(min / x), max);
}

"use strict"
let t = +readline ();
while (t--)
{
  let count = 0, count2 = 0;
  let list = readline ().split (' ').map (i => +i);
  let arr = readline ().split (' ').map (i => +i);
    for (let j of arr)
    {
      count += j;
      count2 += Math.ceil (j / list[1]);
    }
  print (Math.ceil (count / list[1]), count2);
}

"use strict"

let iter = parseInt(readline());

for(let i = 0; i < iter; i++){
    let input = readline().split(" ").map(x => parseInt(x));
    let n = input[0];
    let x = input[1];
    let arr = readline().split(" ").map(x => parseInt(x));

    let sum = 0;
    let sum2 = 0;

    for(let j = 0; j < n; j++){
        sum += arr[j];
        sum2 += Math.ceil(arr[j] / x)
    }

    print(Math.ceil(sum / x) + " " + (sum2));
}

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

    var sum = 0, res = 0;
    var arr = readline().split(' ').map(x => +x);
    for (var i = 0; i < arr.length; i++){
        sum += arr[i];
        res += Math.ceil(arr[i] / m);
    }
    print(Math.ceil(sum / m), res);
}

const solve = (n, x, a) => {
    let sum = a.reduce((x, y) => x + y);
    let restT = 0;
    for (const item of a) {
        let tmp = item / x - Math.floor(item / x);
        restT += item % n;
    }
    let min = Math.round(sum / n);
    let max = Math.round(sum / n) + Math.floor(restT / n);
    console.log(min, max);
};

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

main()

const solve = (n, x, a) => {
    let sum = a.reduce((x, y) => x + y);
    let restT = 0;
    for (const item of a) {
        restT += item % n;
    }
    let min = Math.floor(sum / n);
    let max = Math.floor(sum / n) + Math.floor(restT / n);
    console.log(min, max);
}

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

main()

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

String.prototype.parseInt = (e) => parseInt(e);

let meow=-1,n,x,t;
let sumall,sum2;

function foo(line) {
	if(meow==-1) { n=-1; x=-1; return meow=parseInt(line); }
	if(n==-1) {
		let t = line.split(' ');
		n = t[0]-0;
		x = t[1]-0;

		t=n;
		sumall=0;
		sum2=0;
		return;
	} else {
		let zz = line.split(' ');
		for(let i=0;i<zz.length;i++) {
			let val = zz[i]-0;
			"console.warn(val);"
			sumall+=val;
			sum2+=((val+x-1)/x) | 0;
		}
			"console.warn('nx=',n,x);"
		if(0==0) { console.log(((sumall+(x-1))/x)|0,' ',sum2); }
		n=-1; x=-1;
	}
}

// multi line input
readline.on('line', line => foo(line));

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

String.prototype.parseInt = (e) => parseInt(e);

let meow=-1,n,x,t;
let sumall,sum2;

function foo(line) {
	if(meow==-1) { n=-1; x=-1; return meow=parseInt(line); }
	if(n==-1) {
		let t = line.split(' ');
		n = t[0]-0;
		x = t[1]-0;

		t=n;
		sumall=0;
		sum2=0;
		return;
	} else {
		let zz = line.split(' ');
		for(let i=0;i<n;i++) {
			let val = zz[i]-0;
			"console.warn(val);"
			sumall+=val;
			sum2+=((val+x-1)/x) | 0;
		}
			"console.warn('nx=',n,x);"
		if(0==0) { console.log(((sumall+(x-1))/x)|0,' ',sum2); }
		n=-1; x=-1;
	}
}

// multi line input
readline.on('line', line => foo(line));

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

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

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

//-----------main fucntion-----------

function main() {
    var tc = parseInt(readline());
    while (tc--) {
        var ar = readline().split(" ").map(e => +e);
        var n = ar[0], x = ar[1];
        var sum = 0, maxB = 0;
        var a = readline().split(" ").map(e => +e).map(e=>{
            sum+=e;maxB+=parseInt(e/x);if(e%x)maxB++
        });
        var minB = parseInt(sum / x);
        if (sum % x) minB++;
        console.log(minB + " " + maxB);
    }

}

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

function print(x) {
    console.log(x);
}

let inputString = "";
let currentLine = 0;

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

//-----------main function-----------

function main() {

    var t = parseInt(readline());

while (t--) {
  var ar = readline().split(' ').map(n => parseInt(n));
  var arr = readline().split(' ').map(n => parseInt(n));

  var n = ar[0];
  var x = ar[1];

  var minimal, maximal;

  const beauty = (arrayInput, divisor) => {
    var result = 0;
    arrayInput.forEach(element => {
      result = result + Math.ceil(element / divisor);
    });

    return result;
  }

  minimal = beauty(arr, x);

  for (var i = arr.length - 1; i >= 1; i--) {
    arr[i - 1] = arr[i - 1] + arr[i];
    arr.pop();
  }

  maximal = beauty(arr, x);

  print(maximal, minimal);

}

}

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

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

function main() {
	let t = +readLine();
	while (t--) {
		const [len, x] = readLine().split(' ').map(Number);
		let [sum, divSum] = [0, 0];
		readLine()
			.split(' ')
			.forEach((n) => {
				n = Number(n);
				sum += n;
				divSum += Math.ceil(n / x);
			});
		console.log(`${Math.floor(sum / x)} ${divSum}`);
	}
}

r = readline

for(k = r(); k--; ) {

    x = r().split(' ')[1]
    a = r().split(' ')
    ma = 0; mi = 0;
    a.map(a => {ma += Math.ceil(a/x); mi-=-a;})
    print(ma + " " + Math.ceil(mi/x))
}

r = readline

for(k = r(); k--; ) {

    x = r().split('')[1]
    a = r().split('')
    ma = 0; mi = 0;
    a.map(a => {ma += Math.ceil(a/x); mi-=-a;})
    print(ma + " " + Math.ceil(mi/x))
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;
  var min = 0;

  for (var k = 0; k < n; k++) {
    max += Math.ceil(a[k] / x);
  }

  for (var z = 0; z < n; z += 2) {
    min += Math.ceil((a[z] + (a[z+1] || 0)) / x);
  }

  print(min, max);
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;
  var min = 0;

  for (var k = 0; k < n; k++) {
    max += Math.ceil(a[k] / x);
  }

  for (var z = 0; z < n; z += 2) {
    min += (a[z] + (a[z+1] || 0)) / x;
  }

  print(min.toFixed(0), max);
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;
  var min = 0;

  for (var k = 0; k < n; k++) {
    max += Math.ceil(a[k] / x);
  }

  for (var z = 0; z < n; z += 2) {
    min += (a[z] + (a[z+1] || 0)) / x;
  }

  print(Math.ceil(min), max);
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;
  var min = 0;
  var temp = [];

  for (var k = 0; k < n; k++) {
    max += Math.ceil(a[k] / x);
  }

  for (var z = 0, d = 0; z < n - 1; z++) {
    if (a[d+1]) {
      min += (a[d] + a[d+1]) / x;
    } else {
      min += a[d] / x;
    }

    d += 2;
  }

  print(min, max);
}

var t = +readline();

for (var i = 0; i < t; i++) {
  var l = readline().split(' ').map(i => +i);
  var n = l[0];
  var x = l[1];
  var a = readline().split(' ').map(i => +i);
  var max = 0;

  for (var k = 0; k < a.length; k++) {
    max += Math.ceil(a[k] / x);
  }

  print(Math.max(...a) - Math.min(...a), max);
}

"use strict"

let iter = parseInt(readline());

for(let i = 0; i < iter; i++){
    let input = readline().split(" ").map(x => parseInt(x));
    let n = input[0];
    let x = input[1];
    let arr = readline().split(" ").map(x => parseInt(x));

    let sum = 0;
    let temp = 0;

    for(let j = 0; j < n; j++){
        sum += arr[j];
        if(arr[j] % x !== 0){
            temp++;
        }
    }
    let min = Math.ceil(sum / x);
    print(min + " " + (min + temp));
}

"use strict"

let iter = parseInt(readline());

for(let i = 0; i < iter; i++){
    let input = readline().split(" ").map(x => parseInt(x));
    let n = input[0];
    let x = input[1];
    let arr = readline().split(" ").map(x => parseInt(x));

    let min = 0;
    let temp = 0;

    for(let j = 0; j < n; j++){
        min += Math.ceil(arr[j] / x);
        if(arr[j] % x !== 0){
            temp++;
        }
    }
    print(min + " " + (min + temp));
}


Vladik and Chloe decided to determine who of them is better at math. Vladik claimed that for any positive integer n he can represent fraction  as a sum of three distinct positive fractions in form .Help Vladik with that, i.e for a given n find three distinct positive integers x, y and z such that . Because Chloe can't check Vladik's answer if the numbers are large, he asks you to print numbers not exceeding 109.If there is no such answer, print -1.

The single line contains single integer n (1 ≤ n ≤ 104).

If the answer exists, print 3 distinct numbers x, y and z (1 ≤ x, y, z ≤ 109, x ≠ y, x ≠ z, y ≠ z). Otherwise print -1. If there are multiple answers, print any of them.

const input = Number(readline());
print(input === 1 ? "-1" : `${input} ${input + 1} ${input * (input + 1)}`);

const input = Number(readline());
print(`${input} ${input + 1} ${input * (input + 1)}`);


Recently Vasya decided to improve his pistol shooting skills. Today his coach offered him the following exercise. He placed $$$n$$$ cans in a row on a table. Cans are numbered from left to right from $$$1$$$ to $$$n$$$. Vasya has to knock down each can exactly once to finish the exercise. He is allowed to choose the order in which he will knock the cans down.Vasya knows that the durability of the $$$i$$$-th can is $$$a_i$$$. It means that if Vasya has already knocked $$$x$$$ cans down and is now about to start shooting the $$$i$$$-th one, he will need $$$(a_i \cdot x + 1)$$$ shots to knock it down. You can assume that if Vasya starts shooting the $$$i$$$-th can, he will be shooting it until he knocks it down.Your task is to choose such an order of shooting so that the number of shots required to knock each of the $$$n$$$ given cans down exactly once is minimum possible.

The first line of the input contains one integer $$$n$$$ $$$(2 \le n \le 1\,000)$$$ — the number of cans. The second line of the input contains the sequence $$$a_1, a_2, \dots, a_n$$$ $$$(1 \le a_i \le 1\,000)$$$, where $$$a_i$$$ is the durability of the $$$i$$$-th can.

In the first line print the minimum number of shots required to knock each of the $$$n$$$ given cans down exactly once. In the second line print the sequence consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ — the order of indices of cans that minimizes the number of shots required. If there are several answers, you can print any of them.

NoteIn the first example Vasya can start shooting from the first can. He knocks it down with the first shot because he haven't knocked any other cans down before. After that he has to shoot the third can. To knock it down he shoots $$$20 \cdot 1 + 1 = 21$$$ times. After that only second can remains. To knock it down Vasya shoots $$$10 \cdot 2 + 1 = 21$$$ times. So the total number of shots is $$$1 + 21 + 21 = 43$$$.In the second example the order of shooting does not matter because all cans have the same durability.

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    var n = readline();
    var a = readline();
    solve(n, a);
}

function solve(n, a){
    let sortAr = [];
    let res = [];
    let x = 0;
    let cnt = 0;
    a.split(' ').forEach((el, idx) => {
        sortAr.push({i: idx, a: el});
    });
    sortAr.sort((a, b) => parseInt(a.a) - parseInt(b.a)).reverse();
    sortAr.forEach((el, idx) => {
        x += el.a*cnt + 1;
        res.push(el.i+1);
        cnt++;
    });
    console.log(x);
    console.log(res.join(' '));
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const {EOL} = require('os')
    const lines = i.split(EOL) /*your input text, split by lines*/
    const scores = lines[1]
        .split(' ')
        .map(r => parseInt(r))
        .filter(r => r)
        .map((v, i) => ({ i, v }))
    scores.sort((x, y) => y.v - x.v)
    const total = scores.reduce((s, r, i) => s + (i * r.v + 1), 0)
    const order = scores.map(r => r.i + 1).join(' ')
    console.log(total);
    console.log(order)
})

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

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

process.stdin.on('end', () => {
  arr = arr.split('\n')

  const no = parseInt(arr.shift())
  const cans = arr[0].split(' ')
  const map = new Map()

  for(let i = 1; i <= no; i++) {
    map.set(i, parseInt(cans[i - 1]))
  }

  const map2 = new Map([...map.entries()].sort((a, b) => b[1] - a[1]))
  var sum = 0
  var i = 0
  map2.forEach((v) => {
    sum += v * i + 1
    i++
  })

  console.log(sum)

  const keys = map2.keys()
  let result = keys.next()
  while(!result.done) {
    process.stdout.write(result.value + ' ')
    result = keys.next()
  }
  console.log()
})

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

    function foo (data) {

        let list = [...data];

        let pushCount = 0;
        let order = []
        let i = 0;
        while (i < list.length) {
            let max = Math.max(...list);
            let index = list.indexOf(max);

            pushCount += (list[index] * i + 1);
            order.push(index + 1);
            list[index] = 0;

            i++;
        }

        return {pushCount, order: order.join(' ')};
    }

    let count = +lines[0];
    let data = lines[1].split(' ').map(Number);

    let result = foo(data);

    let answer = '';
    answer += result.pushCount + "\n";
    answer += result.order;

    console.log(answer);
})

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

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

  const arr = d.split(' ').map((x, i) => {
    return {
      val: Number(x),
      idx: i + 1,
    }
  });

  arr.sort((a, b) => b.val - a.val);
  let ans = 0;
  const ansArr = [];

  for (let i = 0; i < arr.length; i++) {
    ans += i * arr[i].val + 1;
    ansArr.push(arr[i].idx);
  }

  console.log(ans);
  console.log(ansArr.join(' '));

  // const arr = d.split(' ').map(Number);
  // const copyArr = arr.concat();
  // copyArr.sort((a, b) => b - a);

  // let ans = 0;
  // const ansArr = [];

  // for (let i = 0; i < copyArr.length; i++) {
  //   let currPoints = i * copyArr[i] + 1;
  //   ans += currPoints;
  // }

  // for (let i = 0; i < copyArr.length; i++) {
  //   for (let j = 0; j < arr.length; j++) {
  //     if (arr[j] === copyArr[i]) {
  //       ansArr.push(j + 1);
  //       arr[j] = 0;
  //     }
  //   }
  // }

  // console.log(ans);
  // console.log(ansArr.join(' '));

  c++;
});

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

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

  const arr = d.split(' ').map(Number);
  const copyArr = arr.concat();
  copyArr.sort((a, b) => b - a);

  let ans = 0;
  const ansArr = [];

  for (let i = 0; i < copyArr.length; i++) {
    let currPoints = i * copyArr[i] + 1;
    ans += currPoints;
  }

  for (let i = 0; i < copyArr.length; i++) {
    for (let j = 0; j < arr.length; j++) {
      if (arr[j] === copyArr[i]) {
        ansArr.push(j + 1);
        arr[j] = 0;
      }
    }
  }

  console.log(ans);
  console.log(ansArr.join(' '));

  c++;
});

'use strict'

const n = parseInt(readline());
const a = readline().split(' ').map(Number);

const b = a.map((v, k) => ({ k, v })).sort((x, y) => y.v - x.v);

write(b.map(i => i.v).reduce((r, i, ix) => r + ix * i + 1, 0) + '\n' + b.map(i => i.k + 1).join(' '));


We will consider the numbers $$$a$$$ and $$$b$$$ as adjacent if they differ by exactly one, that is, $$$|a-b|=1$$$.We will consider cells of a square matrix $$$n \times n$$$ as adjacent if they have a common side, that is, for cell $$$(r, c)$$$ cells $$$(r, c-1)$$$, $$$(r, c+1)$$$, $$$(r-1, c)$$$ and $$$(r+1, c)$$$ are adjacent to it.For a given number $$$n$$$, construct a square matrix $$$n \times n$$$ such that:   Each integer from $$$1$$$ to $$$n^2$$$ occurs in this matrix exactly once;  If $$$(r_1, c_1)$$$ and $$$(r_2, c_2)$$$ are adjacent cells, then the numbers written in them must not be adjacent.

The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$). Then $$$t$$$ test cases follow. Each test case is characterized by one integer $$$n$$$ ($$$1 \le n \le 100$$$).

For each test case, output:    -1, if the required matrix does not exist;  the required matrix, otherwise (any such matrix if many of them exist).  The matrix should be outputted as $$$n$$$ lines, where each line contains $$$n$$$ integers.

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

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    if (n === 1) console.log(1);
    else if (n === 2) console.log(-1);
    else {
      let res = new Array(n).fill(0).map((cur) => new Array(n).fill(0));
      let ans = 0;
      for (let i = 0; i + 1 < n; i++) {
        for (let j = i; j >= 0; j--) res[i - j][j] = ++ans;
      }
      let j = 0;
      for (let i = n - 1; i >= 0; i--) res[j++][i] = ++ans;
      for (let i = 1; i < n; i++) {
        let j = i,
          k = n - 1;
        while (j < n) res[j++][k--] = ++ans;
      }
      res[0][0] = n * n;
      res[n - 1][n - 1] = 1;
      let r = "";
      for (let i = 0; i < n; i++) r += res[i].join(" ") + "\n";
      console.log(r);
    }
  }
};
solve();

const solve = (n) => {
    try {
        if (n === 2) return -1;
        const matrix = [];
        let even = 2;
        let odd = 1;

        for (let i = 0; i < n; i += 1) {
            const internal = [];

            for (let j = 0; j < n; j += 1) {
                if (odd <= n * n) {
                    internal.push(odd);
                    odd += 2;
                } else if (even <= n * n) {
                    internal.push(even);
                    even += 2;
                }
            }
            matrix.push(internal);
        }
        return matrix.map((line) => line.join(' ')).join('\n');
    } catch (ex) {
        console.log('ex:', ex);
    }
};

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

    for (let i = 0; i < n; i++) {
        console.log(solve(+lines[i]));
    }
});

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

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

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

		if (n == 2) {
			console.log(-1);
			continue;
		}

		const ans = Array.from(Array(n), x => Array(n));

		let r = 0, c = 0, nxt = 0;
		while (c < n) {
			let i = r, j = c;
			while (i >= 0 && j < n) {
				ans[i][j] = ++nxt;
				i--; j++;
			}
			if (r < n - 1)
				r++;
			else
				c++;
		}

		[ans[0][0], ans[n-1][n-1]] = [ans[n-1][n-1], ans[0][0]];

		for (const row of ans)
			console.log(row.join(' '));
	}
}

process.stdin.resume();

process.stdin.setEncoding('utf8');

var input = '';

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

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

    while(testCases--){
        let n = +input[z++];
        if(n === 1) console.log(1);
        else if(n === 2) console.log(-1);
        else{
            let counter = 1;
            let arr = Array.from({length : n}, ()=>[])
            for (let i = 0; i < n; i++) {
                arr[i][i] = counter;
                counter++;
            }
            for (let i = 1; i < n; i++) {
                let j = 0;
                let k = i;
                while (k < n && j < n) {
                    arr[j][k] = counter;
                    counter++;
                    k++;
                    j++;
                }
                j = 0;
                k = i;
                while (k < n && j < n) {
                    arr[k][j] = counter;
                    counter++;
                    k++;
                    j++;
                }
            }
            for (let i = 0; i < n; i++) {
                console.log(...arr[i]);
            }
        }
    }
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
let input = [];
rl.on('line', line => {
    input.push(line);
})
rl.on('close', line => {
    var t = Number(input[0]);
    for (var a = 1; a < input.length; a++) {
        var n = Number(input[a]);
        if (n === 1) {
            console.log(1);
        } else if (n === 2) {
            console.log(-1);
        } else {
            var arr = new Array(n).fill();
            for (var i = 0; i < n; i++) {
                arr[i] = new Array(n);
            }
            var count = 1;
            for (var k = 0; k < n; k++) {
                arr[k][k] = count;
                count++;
            }
            for (var k = 1; k < n; k++) {
                var i = 0, j = k;
                while (i < n && j < n) {
                    arr[i][j] = count;
                    count++;
                    i++;
                    j++;
                }
                var i = k, j = 0;
                while (i < n && j < n) {
                    arr[i][j] = count;
                    count++;
                    i++;
                    j++;
                }
            }
            for (var i = 0; i < arr.length; i++) {
                console.log(arr[i].join(" "));
            }
        }
    }
})

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

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

let count = -1
let inputArr = []

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

function solve(n) {
    if (n === 2) {
        console.log('-1')
        return
    }
    let matrix = Array(n * n)
    let num = 0, row = 0
    for (let i = 0; i < n * n; i += 2) matrix[i] = ++num
    for (let i = 1; i < n * n; i += 2) matrix[i] = ++num
    for (let i = 0; i < n; i++) {
        console.log(matrix.slice(row, row + n).join(' '))
        row += n
    }
}

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

const solve = (n) => {
	if (n === 2) {
		return -1;
	}

	const matrix = [];

	let counter = 1;
	for (let i=0; i<n; i++) {
		for (let j=0; j<n; j++) {
			matrix[(i+j)%n] = matrix[(i+j)%n] || [];
			matrix[(i+j)%n][j] = counter;
			counter += 1;
		}
	}

	return matrix.map(line => line.join(' ')).join('\n');
}

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

	for (let i=0; i<n; i++) {
		console.log(solve(+lines[i]))
	}
})

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

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

function main() {
	let t = +readLine();
	while (t--) {
		const n = +readLine();
		if (n === 1) console.log(1);
		else if (n === 2) console.log(-1);
		else {
			const arr = Array(n)
				.fill(0)
				.map((_) => Array(n).fill(0));
			let [status, count] = ['odd', 1];
			for (let row = 0; row < n; row++) {
				for (let col = 0; col < n; col++) {
					if (status === 'odd') {
						if (count <= n ** 2) {
							arr[row][col] = count;
							count += 2;
						} else {
							status = 'even';
							arr[row][col] = 2;
							count = 4;
						}
					} else {
						if (count <= n ** 2) {
							arr[row][col] = count;
							count += 2;
						}
					}
				}
			}

			for (let row = 0; row < n; row++) {
				console.log(arr[row].join(' '));
			}
		}
	}
}

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

//Don't have to see. end------------------------------------------

function Main(){
	var t = nextInt();
	for(var i = 0; i < t; i++){
		var N = nextInt();
		if(N == 2){
			myout(-1);
			continue;
		}
		var list = new Array(N);
		for(var j = 0; j < N; j++){
			list[j] = new Array(N);
		}
		var V = 1;
		for(var j = 0; j < N; j++){
			for(var k = (j % 2 == 0) ? 0 : 1; k < N; k += 2){
				list[j][k] = V;
				V++;
			}
		}
		for(var j = 0; j < N; j++){
			for(var k = 0; k < N; k++){
				if(list[j][k] == null){
					list[j][k] = V;
					V++;
				}
			}
		}
		for(var j = 0; j < N; j++){
			myout(myconv(list[j], 8));
		}
	}
}

const t = parseInt(readline());

for (var _ = 0; _ < t; _++) {
  var n = parseInt(readline());

  if (n === 1)
    print(n);
  else if (n === 2)
    print(-1);
  else {
    var sqn = n * n;
    var p = 0;
    var s = "";
    for (var i = 1; i <= sqn; i += 2) {
      s += i + ' ';
      p++;
      if (p === n) {
        print(s);
        s = "";
        p = 0;
      }
    }
    for (var i = 2; i <= sqn; i += 2) {
      s += i + ' ';
      p++;
      if (p === n) {
        print(s);
        s = "";
        p = 0;
      }
    }
  }
}

var numberOfCases = Number(readline());
for (var i = 0; i < numberOfCases; ++i) {
    processCase();
}

function processCase() {
    var n = Number(readline());
    if (n === 1) {
        return print("1");
    }

    if (n === 2) {
        return print("-1");
    }

    var currentNumber = 1;
    for (var i = 0; i < n; ++i) {
        for (var j = 0; j < n; ++j) {
            write(currentNumber, "");
            currentNumber += 2;
            if (currentNumber > n * n) {
                currentNumber = 2;
            }

        }

        write("\n");
    }
}

var T = parseInt(readline());
var U = 1
var N = 1
var u = 1
var s = ""
function next() {
    var t = (u).toString(10);
    u += 2;
    if (u > U)
        u = 2;
    return t; }
while (T--) {
    N = parseInt(readline());
    U = N*N
    switch (N) {
    case 1:
        print(1); break;
    case 2:
        print(-1); break;
    default:
        for (var i = 0; i < N; ++i) {
		    s += next();
		    for (var j = 1; j < N; ++j)
				s += " "+next();
			print(s);
			s = ""; }
		u = 1; } }

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

const solve = () => {
  let t = parseInt(readline());
  while (t--) {
    let n = parseInt(readline());
    if (n === 1) console.log(1);
    else if (n === 2) console.log(-1);
    else {
      let res = new Array(n).fill(0).map((cur) => new Array(n).fill(0));
      let ans = 0;
      for (let i = 0; i + 1 < n; i++) {
        for (let j = i; j >= 0; j--) res[i - j][j] = ++ans;
      }
      let j = 0;
      for (let i = n - 1; i >= 0; i--) res[j++][i] = ++ans;
      for (let i = 1; i < n; i++) {
        let j = i,
          k = n - 1;
        while (j < n) res[j++][k--] = ++ans;
      }
      let r = "";
      for (let i = 0; i < n; i++) r += res[i].join(" ") + "\n";
      console.log(r);
    }
  }
};
solve();

const solve = (n) => {
    try {
        if (n === 2) return -1;
        const matrix = [];
        let even = 2;
        let odd = 1;
        for (let i = 0; i < n; i += 1) {
            for (let j = 0; j < n; j += 1) {
                if (odd <= n * n) {
                    matrix.push(odd);
                    odd += 2;
                } else if (even <= n * n) {
                    matrix.push(even);
                    even += 2;
                }
            }
        }
        return matrix;
    } catch (ex) {
        console.log('ex:', ex);
    }
};

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

    for (let i = 0; i < n; i++) {
        console.log(solve(+lines[i]));
    }
});

const t=parseInt(readline());

for(var k=0;k<t;k++)
{
    var n=parseInt(readline());
    if(n%2===0)
    {
        print("-1");
    }
    else
    {
        var p=1;
        var q=n*n;
        for(var i=0;i<n;i++)
        {
            var s="";
            for(var j=0;j<n;j++)
            {

                if((i+j)%2==1)
                {
                    s+= p+" ";
                    p++;
                }
                else
                {
                    s+= q+" ";

                    q--;
                }
            }
            print(s);
        }
    }

}