var print = this.print || require('lol-io').print; //print --> outputs result and adds (enter)
var write = this.write || require('lol-io').write; //write --> creates output.txt with output
var readline = this.readline || require('lol-io').readline; //readline --> reads unread line of input.txt

var t, arr, ans, candy, children;

t = Number(readline());

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

    arr = readline().replace(/\r$/, '').split(' ').map(Number);
    ans = 0;
    candy = arr[0];
    children = arr[1];

    ans = (Math.floor(candy / children)) * children;
    candy -= ans;

    if (candy > Math.floor(children / 2)) {

        ans += Math.floor(children / 2)
    } else {

        ans += candy;
    }

    print(ans)
}

var cant = readline();

for (var i=0; i < cant; i++) {
   var num = readline().split(" ").map(x => parseInt(x));
   var k = num[1];
   var n = num[0];
   var full = n - n % k;
   full+= Math.min(n%k, k/2);
   print(Math.floor(full));
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy > halfChildren) {
            restCandy = halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}

var n = parseInt(readline());
while(n--){
  var z = readline();
  var t = z.split(' ').map(e => parseInt(e));
  print(Math.min(t[0], t[0] - t[0]%t[1] + Math.floor(t[1]/2)));
}

'use strict'

const problem = (n, k) => (n - n % k) + Math.min(k >> 1, n % k)
let q = +readline();
while(q--) print(problem(...readline().split(' ').map(Number)))

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var nchilds = readline().split(' ').map(Number);
    var n = nchilds[0];
    var childs = nchilds[1];
    var base = Math.floor(n / childs);
    var other = Math.min(n - childs * base, Math.floor(childs / 2))
    print(childs * base + other);
  }
}

main();

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

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

function stringArrayToNumbers(str) {
    var array = str.split(" ");
    var result = [];
    for( var i = 0; i < array.length; i++ ) {
        result.push( parseInt(array[i]) );
    }
    return result;
}

function stringArrayToBigInts(str) {
    var array = str.split(" ");
    var result = [];
    for( var i = 0; i < array.length; i++ ) {
        result.push( BigInt(array[i]) );
    }
    return result;
}

// ======================================================
// B. Candies Division
// http://codeforces.com/problemset/problem/1283/B
// ======================================================

function doIt( numOfCandies, numOfKids ) {

    var candiesPerKid = Math.floor(numOfCandies/numOfKids);
    var candiesLeft = (numOfCandies % numOfKids);
    var extra = candiesLeft;
    if( extra > numOfKids / 2 ) {
        extra = Math.floor(numOfKids / 2);
    }
    var result = candiesPerKid * numOfKids + extra;
    printALine(result);

}

function main() {

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

}

'use strict';

const fs = require('fs');

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

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    return sharedCandies + min(remainedCandies, parseInt(kids / 2));
}

function min(value1, value2) {
    return value1 < value2 ? value1 : value2;
}

"use strict";

let numberOfInputs = +readline();

let arrayOfInputs = [];
let nk = [];

for (let i = 0; i < numberOfInputs; i++) {
	arrayOfInputs[i] = readline();
	nk[i] = arrayOfInputs[i].split(' ').map(function(item) {
		return +item;
	});
}

function getGoodCandyNumber(n, k) {
	let goodCelNumber = 0;
	let goodOst = 0;
	let ost = n % k;

	// goodCelNumber = (n - n%k)/k;

	if (ost > Math.floor(k / 2)) {
		goodOst = Math.floor(k / 2);
		return n - (ost - goodOst);
	} else {
		goodOst = ost;
		return n;
	}
}

for (let i = 0; i < numberOfInputs; i++) {
	print(getGoodCandyNumber(nk[i][0], nk[i][1]));
}

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

  const t = readInt(arr)

  for(let j = 0; j < t; j++) {
    const [n, k] = readInts(arr, j)

    let rem = n % k
    let a = Math.floor(n / k)
    let ans = k * a + Math.min(Math.floor(k / 2), rem)

    wr(ans)
  }
})

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

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 [n, k] = d.split(' ').map(Number);
  const ans = Math.min(n, Math.floor(n / k) * k + Math.floor(k / 2));
  console.log(ans);

  c++;
});

var t = readline();
while(t--) {
    var a = readline().split(" ").map(function(num) {
        return parseInt(num);
    });
    var modest = Math.floor(a[0] / a[1]);
    var remainder = a[0] % a[1];
    var border = Math.floor(a[1] / 2);
    if(remainder > border) {
        remainder = border;
    }
    var ans = modest * a[1] + remainder;
    print(ans);
}

'use strict';

const fs = require('fs');

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

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies > (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(kids / 2);
    }

    return sharedCandies;
}

'use strict';

const fs = require('fs');

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

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies >= (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(remainedCandies / 2) + 1;
    }

    return sharedCandies;
}

'use strict';

const fs = require('fs');

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

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies >= (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(kids / 2) + 1;
    }

    return sharedCandies;
}

'use strict';

const fs = require('fs');

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

function main(inputString) {
    let index = 0;
    let tests = inputString[index++];

    for (let i = 0; i < tests; ++i) {
        let inputs = inputString[index++].split(' ');
        let candies = inputs[0], kids = inputs[1];
        console.log(candiesShared(candies, kids))
    }
}

function candiesShared(candies, kids) {
    let sharedCandies = 0, remainedCandies;

    sharedCandies += parseInt(candies / kids)*kids;
    remainedCandies = candies % kids;

    if (remainedCandies >= (parseInt(kids / 2) - 1)) {
        sharedCandies += parseInt(kids / 2);
    }

    return sharedCandies;
}

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

  const t = readInt(arr)

  for(let j = 0; j < t; j++) {
    const [n, k] = readInts(arr, j)

    let rem = n % k
    let a = Math.floor(n / k)
    let ans = k * a + Math.floor(k / 2)

    wr(ans)
  }
})

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

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

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

  const [n, k] = d.split(' ').map(Number);

  if (n % k === 0) {
    ans += `${Math.floor(n / k) * k}\n`;
  }
  else {
    ans += `${Math.floor(n / k) * k + Math.floor(k / 2)}\n`;
  }
  c++;
});

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

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

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

  const [n, k] = d.split(' ').map(Number);

  if (n <= k) {
    ans += `${n}\n`;
  }
  else if (n % k === 0) {
    ans += `${Math.floor(n / k) * k}\n`;
  }
  else {
    ans += `${Math.min(n, Math.floor(n / k) * k + Math.floor(k / 2))}\n`;
  }
  c++;
});

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

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

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

  const [n, k] = d.split(' ').map(Number);

  if (n <= k) {
    ans += `${n}\n`;
  }
  else if (n % k === 0) {
    ans += `${Math.floor(n / k) * k}\n`;
  }
  else {
    ans += `${Math.floor(n / k) * k + Math.floor(k / 2)}\n`;
  }
  c++;
});

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

'use strict';

let friendsNumber = +readline(); //!
let wishString = readline(); //!
let arrayOfWishNumbers = wishString.split(" ").map(function(item) {
	return +item;
});

let sortedWish = [];
let zeroIndexes = [];
let zeroValues = [];

for (let i = 0; i < arrayOfWishNumbers.length; i++) {
	if (arrayOfWishNumbers[i] === 0) {
		zeroIndexes.push(i);
	}
	sortedWish[i] = 0;
}

for (let i = 0; i < sortedWish.length; i++) {
	if (arrayOfWishNumbers[i] !== 0) {
		sortedWish[arrayOfWishNumbers[i] - 1] = arrayOfWishNumbers[i];
	}
}

for (let i = 0; i < sortedWish.length; i++) {
	if (sortedWish[i] === 0) {
		zeroValues.push(i + 1);
	}
}

let goodSortedZeroValues = [];
//

// zeroValues = zeroValues.reverse();
// if (zeroValues.length % 2 == 1) {
// 	let tempValue = zeroValues[Math.floor(zeroValues.length / 2)];
// 	zeroValues[Math.floor(zeroValues.length / 2)] = zeroValues[Math.floor(zeroValues.length / 2) + 1];
// 	zeroValues[Math.floor(zeroValues.length / 2) + 1] = tempValue;
// }

// let badSortedValues = [];

// for (let i = 0; i < zeroValues.length; i++) {
// 	if (zeroValues[i] = zeroIndexes[i] + 1) {
// 		badSortedValues.push(zeroValues[i]);
// 	}
// }

// for (let i = 0; i < badSortedValues.length; i++) {
// 	for (let j = 0; j < zeroValues.length; j++) {
// 		if (zeroValues[j] === badSortedValues[i]) {
// 			let tempValue = zeroValues[j];
// 			for (let k = 0; k < zeroValues.length; k++) {
// 				if (zeroValues[k] !== 0;)
// 			}
// 		}
// 	}
// }

for (let i = 0; i < zeroValues.length; i++) {
	if (zeroValues[i] === zeroIndexes[i] + 1) {
		for (let j = 0; j < zeroValues.length; j++) {
			let tempValue = zeroValues[i];
			if (zeroValues[i] !== zeroValues[j]) {
				zeroValues[i] = zeroValues[j];
				zeroValues[j] = tempValue;
				break;
			}
		}
	}
}

//
if (zeroValues.length === zeroIndexes.length) {

	for (let i = 0; i < zeroIndexes.length; i++) {
		arrayOfWishNumbers[zeroIndexes[i]] = zeroValues[i];
	}
}

let result = arrayOfWishNumbers.join(" ");

print(result);

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    if (candyCount < childrenCount) {
        print(candyCount);
        continue;
    }
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy > halfChildren) {
            restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy > halfChildren) {
            restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount);
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.ceil(candyCount / childrenCount);
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.ceil(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    } else {
        restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var halfChildren = Math.floor(childrenCount / 2);
    if (restCandy <= halfChildren) {
        restCandy = halfChildren;
    } else {
        restCandy = Math.floor(restCandy/halfChildren) * childrenCount;
    }
    var totalCandy = firstCandy + restCandy;
    print(totalCandy);
}

const lines = readline().split(" ").map(x => parseInt(x));
const t = lines[0];
var candyArray=[];
for (var i=0; i<t; i++) {
    var data = readline().split(" ").map(x => parseInt(x));
    var candyCount = data[0];
    var childrenCount =  data[1];
    var firstCandy = Math.floor(candyCount / childrenCount) * childrenCount;
    var restCandy = candyCount - firstCandy;
    var totalCandy;
    if (restCandy) {
        var halfChildren = Math.floor(childrenCount / 2);
        if (restCandy <= halfChildren) {
            restCandy = halfChildren;
        } else {
            restCandy = Math.floor(restCandy/halfChildren) * halfChildren;
        }
        totalCandy = firstCandy + restCandy;
    } else {
        totalCandy = firstCandy;
    }
    print(totalCandy);
}


function sum(array){
	var result = 0;
	for(var i = 0; i < array.length; i++){
		result += +array[i];
	}
	return result;
}

var n = +readline(), p = readline().split(" ").map(Number),
ans = 0;

print((sum(p)/n).toFixed(12));

function main() {
    // write code here:
    const n = Number(stdin[0]);
    var arr = stdin[1].split(' ').map(Number);
    var percent=0.0;
    for(let i=0;i<n;i++){
        //parseFloat()这一函数很管用，解决小数点后0的问题
        percent+=parseFloat(arr[i]/100);
    }
    percent=(percent/n)*100;
    console.log(percent.toFixed(12));
}

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

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() {
  const len = +readLine();
  const arr = readLine()
    .split(" ")
    .map((n) => parseInt(n));
  const avg = arr.reduce((avg, num) => {
    avg = avg + num / len;
    return avg;
  }, 0);
  console.log(avg);
}

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

let input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
    const all = parseInt(input[0], 10)
    const percent = input[1].split(' ')
    let all_percent = 0
    percent.forEach(el => {
        all_percent += parseInt(el, 10) / 100
    })
    let _result = (all_percent / all) * 100
    console.log(_result.toFixed(12))
})

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  var list = nextIntArray();
  var sum = 0;
  for(var i = 0; i < N; i++){
    var tmp = list[i] / 100;
    sum += tmp;
  }
  myout((sum / N) * 100);
}

// http://codeforces.com/problemset/problem/977/A
module.exports = solve;
function solve(line) {
    let i = line.split(' ').map(n => parseInt(n, 10));
    return i.reduce((acc, c)=> acc + c, 0)/i.length;
}

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

let i = 0;
rl.on('line', (line) => {
    if (i++) {
        console.log(solve(line))
        rl.close();
    }
});

//Drinks

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

let inp = '';

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

process.stdin.on('end', () => {
    let lines = inp.split(EOL)[1].split(' ').map(c => +c);

    process.stdout.write((lines.reduce((a, b) => a + b) / lines.length) + '');

    return;
});

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

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

  const total = n * 100;
  const values = d.split(' ').map(Number);
  const v = values.reduce((acc, curr) => acc + curr, 0);
  const ans = v / total * 100;

  console.log(ans);

  c++;
});

const input = [];

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

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

RL.on('close', () => {
  const nums = input[1].split(' ').map(x => parseInt(x));
  let answer = 0.0;
  nums.forEach(i => answer += i);

  console.log( (answer / nums.length).toPrecision(12) );
});

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 isPrime(x) {
	let s = Math.sqrt(x);
	let i = 2;
	while (i <= s) {
		if (x % i === 0) {
			return false;
		}
		i++;
	}
	return true;
}

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

	let x = 0;

	arr.forEach(item => (x += item / 100));
	x /= n;
	x *= 100;
	console.log(x.toFixed(12));
}

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

function main() {
    let n = parseInt(readLine());
    let portions = readLine().split(' ').map(Number);
    let orangePortions = 0;

    for (let i = 0; i < portions.length; i++) {
        orangePortions = orangePortions + portions[i] / 100;
    }

    let orangeValue = orangePortions / n;

    console.log(orangeValue * 100);
}

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

const input = [];
readline.on('line', line => { input.push(line); });

readline.on('close', () => {
    const [n] = input[0].split(' ').map(Number);
    const arr = input[1].split(' ').map(Number);
    console.log(arr.reduce((acc, curr) => acc + curr) / n);
});

const readline = require('readline');

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

var count = 0;
var total = 0.0;
var mix = 0;

rl.on('line', (data) => {

    if(count!=0) {
        data = data .trim();

        var splitted = data.split(" ");
        var len = splitted.length;

        for(var idx = 0; idx<len; idx++) {
            total = total + (parseFloat(splitted[idx])/100);
        }

        var vardict = total/mix;
        vardict*=100;
        console.log(vardict.toFixed(12));

        count = 0, total = 0.0, mix = 0;

    } else {
        data = data .trim();
        mix = parseInt(data);
        ++count;
    }
});

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*/
    let totalDrinksInFridge = parseInt(lines[0]);
    let orangePercentagePerDrink = lines[1].split(" ").map( value => {
        return parseInt(value)
    });

    let totalOragePercentage = 0
    orangePercentagePerDrink.forEach( singleDrinkPercentage => {
        totalOragePercentage = totalOragePercentage + singleDrinkPercentage
    })

    let orangeVolumeInCoktail = (totalOragePercentage / totalDrinksInFridge)

    console.log(orangeVolumeInCoktail.toPrecision(14))
})

let fs = require('fs');

let txt = fs.readFileSync(0, "utf-8").split("\n").filter(data => data.length > 0);
for (let i = 0; i < txt.length; i += 2) {
    doit(txt[i] * 1, txt[i + 1].split(" ").filter(data => data.length > 0).map(data => data * 1));
}

function doit(num, tab) {
    let sum = 0;
    tab.forEach(data => {
        sum += data / 100;
    });
    console.log(sum / num * 100);
}

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

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().replace(/\r/g, '').split('\n');
    let percentageDrinks = inputs[1].split(' ');
    let sum = 0;
    for (let i = 0; i < +inputs[0]; i++) {
        if (percentageDrinks[i] != 0) {
            let denominator = Number(100 / percentageDrinks[i]).toFixed(2);
            sum += +Number(1 / denominator).toFixed(2);
        }
    }
    sum = (sum / inputs[0]) * 100;

    return sum.toString();
}

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

const input = [];
readLine.on('line', line => input.push(line));
const orange = () => {
    let ar = input[1].split(' ').map(x => +x);
    let q = ar.reduce((a, b) =>( a + b));
    console.log(q / +input[0]);
};
readLine.on('close', orange);

'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() {
    let n = parseInt(readLine());
    let arr = readLine().split(' ').map(value => parseInt(value));
    let total = arr.reduce((sum, value) => {
        return sum + value;
    }, 0)

    console.log(total / n.toFixed(12));
}

var n=readline();
var sum=readline().split(' ').reduce(function(a,b){return a+ +b;}, 0);

print( sum/n );

counter = 0
x = parseInt(readline())
d = readline().split(" ")
for (i=0 ; i<x;i++){
  counter += parseInt(d[i])
}
print(counter/x)

var input = parseInt(readline());
var orange = readline().split(" ").map(x=> parseInt(x));
var total = 0;
var total_orange = 0;
orange.forEach(o=>{
    total+=100;
    total_orange +=o;
    }
    );
    print((total_orange/total)*100);

;(function () {

	var n = +readline();
	var t = readline().split(' ').reduce(function (p, e) { return p + 1/(100/(+e)); }, 0);
	print(100 * t / n);

}).call(this);

var res = sol(readline(), readline());
print(res);

function sol(line, orange) {
    var input = line.split(" ");
    var percent = orange.split(" ").map((x) => Number(x));

    var n = Number(input[0]);

    var o = 0;

    for (var i = 0; i < n; i++) {
        o += (percent[i] / 100);
    }

    return o / n * 100;
}

(function() {
    'use strict';
    const n = readline();
    const z = readline().split(' ').map(Number);
    let x = 0;
    for (let i =0; i < n; ++i) {
        x += z[i] / 100;
    }
    let y = x / n * 100;
    print(y);
}());

var ingredientes = readline();
var porcentajes = readline().split(" ");
var suma_porcentajes = 0;

for (i=0;i<porcentajes.length;i++){
	suma_porcentajes=suma_porcentajes+parseInt(porcentajes[i]);
}

var total = suma_porcentajes/ingredientes;

print(total);

var n=readline().split(' ').map(function(x){return parseInt(x);});
var p=readline().split(' ').map(function(x){return parseInt(x);});
var ans=0;
for(var i=0;i<n;i++)
{
    ans+=(1/n)*p[i];
}
print(ans);

'use strict'
readline();
String.prototype.getNumArray = function () {
  return String(this).split(' ').map(function (value) {
    return parseInt(value);
  });
}

let array = readline().getNumArray(),
    ml = 0;

for (let i = 0; i < array.length; i++) {
  ml += array[i]/100;
}

write(((ml/array.length) * 100).toFixed(4));

var total=0;
// var drinkNumber=prompt();
var drinkNumber=readline();
// var drink=prompt().split(" ");
var drink=readline().split(" ");
// drink=parseInt(drink);
// print(drink);
for(var i=0;i<drinkNumber;i++){
    total=(total+parseInt(drink[i]));
}
// print(total);
// console.log(total/drinkNumber);
print(total/drinkNumber);

var n = readline();
var a = readline().split(' ');
var sum = 0;
for(i = 0; i < n; i++){
    sum += +a[i];
}
var res = (sum/100)/(n)*100;
print(res.toFixed(12));

var n = readline();
var rost = readline().split(" ");
var c = 0;
	for (var i=0; i<n; i++){
		c+=Number(rost[i]);
	}
print(c/n);

var x ,arr=[];
x=parseInt(readline());
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=parseInt(arr[i]);
}
ans=ans/100;
ans=(ans/x)*100;
print(ans);

var x ,arr=[];
x=parseInt(readline());
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=parseInt(arr[i]);
}

print(ans/x);

var n = Number(readline());
var s = readline().split(' ').map(Number);

var sum = 0;

for (var i = 0; i<n; i++) {
    sum+=s[i];
}
print(sum/n);

var computeSpace = function(arr)
    {
       var sum = 0;
        for (var counter = 0; counter <= arr.length - 1; counter++)
        {
            sum += arr[counter];
        }
        return ((sum * 100) / (arr.length * 100)).toFixed(12);
    }
var toNumArr = function(str)
    {
        str = str.split(' ');
        for (var i = 0; i <= str.length - 1; i++)
        {
            str[i] = +str[i];
        }
        return str;
    }
var num = readline();
var input = readline();
print(computeSpace(toNumArr(input)));

var n = parseInt(readline(), 10);
var p = readline().split(' ');

for(var i=0; i<p.length; i++) {
    p[i] = parseInt(p[i], 10);
}

print(p.reduce((a,b) => a+b) / n);

(function main() {
    var n = +readline(),
        result = readline()
            .split(" ")
            .map(function(a) {
                return +a;
            })
            .reduce(function(a, b) {
                return a + b;
            });

    print(result / n);

})();

// 200B   Напитки
/*
function main_1(){
    var n = parseInt(readline());
    var ans = 0;
    while (n--) {
        var nums = readline().split(' ').map(Number);
        ans += (nums[2] - nums[0] + 1) * (nums[3] - nums[1] + 1);
    }
    print(ans);
}

function main(){
    var line  = readline();
    //var line = prompt();
    var n = line.length;
    //alert(line);
    var m = 0;
    for(i=0;i<n;i+=2){
        for(j=i+1;j<n;j+=2){
            var ex = [line.slice(0, i), '(', line.slice(i,j) , ')' , line.slice(j)].join('');
            m = Math.max(m,eval(ex));
        }
    }
    print(m);
}
*/

var n = parseInt(readline());
var arrP = readline().split(' ').map(Number);

var sum = 0;
arrP.forEach(function(item, i, arrP) {
  sum += item;
});

var out = sum / n;

print(out);

var n=readline();
var x= readline().split(' ').map(Number);
var s = 0;
for(var i=0; i<n;i++){
    s += x[i];
}
print(s/n);

var n = readline();
var a = readline().split(' ').map(Number);
var ans = 0;
for(i = 0; i < n; i++) ans += a[i];
print(ans / n);

var numberOfDrinks = readline();
var percentages = readline().split(' ');

var sum = percentages.reduce((acc, percentage) => {
    return acc + parseInt(percentage);
}, 0);

print(sum > 0 ? sum/numberOfDrinks : sum);

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => Number(acc)+Number(cur) ,0);
var answer = result/drinks.length;
print(answer)

var o = readline();
var d = readline().split(' ');
var h = [];
for (i = 0; i <= d.length - 1; i++) {
    h.push(d[i] / 100);
}
function all(total, num) {
    return total + num;
}
var out =  (h.reduce(all) / o ) * 100;
print(out);

var x = readline();
var z = readline().split(" ").map((a)=>(+a));
var y = 0; for (var i = 0; i <z.length; i++){y+=z[i]}
print(y/x)

let lines = [];
require('readline').createInterface({input: process.stdin,output: process.stdout})
				.on('line', line => {lines.push(line);})
				.on('close', () => {main(lines)});

const main = (input) => {
	var n = parseInt(input[0]);
	var percentages = input[1].split(" ").map(num => parseInt(num));
	var sum = 0;
	for (var i = 0; i < n; i++) {
		sum += percentages[i];
	}
	console.log(sum/n);
}

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

let input = [];
readLine.on('line', line => input.push(line));

readLine.on('close', () => {
    const all = parseInt(input[0], 10)
    const percent = [...input.slice(1)]
    let all_percent = 0
    percent.forEach(el => {
        all_percent += parseInt(el, 10) / 100
    })
    let _result = (all_percent / all) * 100
    console.log(_result.toFixed(12))
})

counter = 0
x = parseInt(readline())
d = readline().split(" ")
for (i=0 ; i<x;i++){
  counter += parseInt(d[i])
}
print(counter/3)

var ingredientes = readline();
var porcentajes = readline().split(" ");
var suma_porcentajes = 0;

for (i=0;i<porcentajes.length;i++){
	suma_porcentajes=suma_porcentajes+porcentajes[i];
}

var total = suma_porcentajes/ingredientes;

print(total);

var ingredientes = readline();
var porcentajes = readline().split(" ");
var suma_porcentajes = 0;

for (i=0;i<porcentajes.length;i++){
	suma_porcentajes+=porcentajes[i];
}

var total = suma_porcentajes/ingredientes;

print(total);

var x ,arr=[];
arr=readline().split(' ');
x=parseInt(readline);
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=+arr[i];
}
ans=ans/100;
ans=(ans/x)*100;
print(ans);

var x ,arr=[];
x=Number(readline());
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}

print(ans/x);

var x ,arr=[];
arr=readline().split(' ');
x=readline;
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
ans=ans/100;
ans=(ans/x)*100;
print(ans);

var x ,arr=[];
arr=readline().split(' ');
x=parseInt(readline());
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
var absl=ans/100;
absl=(absl/x);
print(absl*100);

var x ,arr=[];
x=readline().split('');
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
ans=ans/100;
ans=ans/x;
print(ans*100);

var x ,arr=[];
arr=readline().split(' ');
x=readline().split('');
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
print(ans/x);

var x ,arr=[];
x=readline().split('');
arr=readline().split(' ');

var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
print(ans/x);

var x;
var arr=readline().split(' ');
x=readline().split('');
var ans=0;
for(var i=0;i<x;i++)
{
    ans+=arr[i];
}
print(ans/x);

var x= readline().split(' ').map(Number);
var n=readline();
var s = 0;
for(var i=0; i<n;i++){
    s += x[i];
}
print(s/n);

var n = readline();
var a = readline().split(' ');
var ans = 0;
for(i = 0; i < n; i++) ans += a[i];
print(ans / n);

var numberOfDrinks = readline();
var percentages = readline().split(' ');

var sum = percentages.map((acc, percentage) => {
    return acc + percentage;
}, 0);

print(sum > 0 ? sum/numberOfDrinks : sum);

var numberOfDrinks = readline();
var percentages = readline().split(' ');

var sum = percentages.reduce((acc, percentage) => {
    return acc + percentage;
}, 0);

print(sum > 0 ? sum/numberOfDrinks : sum);

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+Number(cur) ,0);
var answer = result/drinks.length;
print(answer)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+cur ,0);
print(result/drinks.length)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+(+cur) ,0);
print(result/drinks.length)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+cur ,0);
var answer = result/drinks.length;
print(answer)

var useless = readline();
var drinks = readline().split(" ");
var result = drinks.reduce((cur,acc) => acc+cur ,0);
var answer = result/drinks.length;
print("Here", drinks, "   ", result, "   ", answer);
print(answer)

var o = readline();
var d = [0, 25, 50, 75];
var h = [];
for (i = 0; i <= d.length - 1; i++) {
    h.push(d[i] / 100);
}
function all(total, num) {
    return total + num;
}
var out =  (h.reduce(all) / o ) * 100;
print(out);


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

let c = 0;

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

  let ans = "";
  const arr = d.split(" ").map(Number);

  for (let i = 0; i < arr.length; i++) {
    const leftVal = i === 0 ? Infinity : arr[i - 1];
    const rightVal = i === arr.length - 1 ? Infinity : arr[i + 1];
    const minL = Math.abs(arr[i] - leftVal);
    const minR = Math.abs(rightVal - arr[i]);
    const min = Math.min(minL, minR);
    const maxL = Math.abs(arr[i] - arr[0]);
    const maxR = Math.abs(arr[arr.length - 1] - arr[i]);
    const max = Math.max(maxL, maxR);

    ans += `${min} ${max}\n`;
  }

  console.log(ans);

  c++;
});

var n = parseInt(readline());
var input = readline().split(' ').map(x=>parseInt(x));
var x=input[0];
var y=input[n-1];
var mn1 , mn2 , mn;
var mx1 , mx2 , mx ;
for(var i=0;i<n;i++){
    mx1 = Math.abs(input[i]-x);
    mx2 = Math.abs(y-input[i]);
    mx = Math.max(mx1,mx2);

    if(i===0)
        mn = input[1]-x;
    else if(i==n-1)
        mn = y-input[n-2];
    else{
        mn1=input[i+1]-input[i];
        mn2=input[i]-input[i-1];
        mn=Math.min(mn1,mn2);
    }

    print(mn + ' '+mx);
}

    var n   = parseInt(readline()),
        c   = readline().split(' '),
        mini,
        maxi,
        diff;

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

        mini = Infinity,
        maxi = 0;

        if(i === 0){
            mini = Math.abs(c[i] - c[i + 1]);
            maxi = Math.abs(c[i] - c[c.length - 1]);
        }
        else if (i === n - 1){
            mini = Math.abs(c[i] - c[i - 1]);
            maxi = Math.abs(c[i] - c[0]);
        }
        else{
            mini = Math.min(Math.abs(c[i] - c[i - 1]), Math.abs(c[i] - c[i + 1]));
            maxi = Math.max(Math.abs(c[i] - c[0]), Math.abs(c[i] - c[c.length - 1]));
        }
        print(mini, maxi);
    }

const N = 1<<17;
const INF = 2000000007;

var a;
var n;
var ans1, ans2;
var token = [];
var arr = [];

function initializeData() {
  a = new Array(N);
  ans1 = new Array(N);
  ans2 = new Array(N);
}

el = function(val, idx) {
  this.value = val;
  this.idx = idx;
}

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

initializeData();

n = parseInt(readline());

token = readline().split(' ');
for(var i=0;i<n;i++) {
  a[i] = parseInt(token[i]);
  arr.push(new el(a[i],i));
}

arr.sort(compareEl);

for(var i=0;i<n;i++) {
  var idx = arr[i].idx;

  ans1[idx] = INF;

  if(i>0) ans1[idx]=Math.min(ans1[idx],arr[i].value-arr[i-1].value);
  if(i+1<n) ans1[idx]=Math.min(ans1[idx],arr[i+1].value-arr[i].value);

  ans2[idx]=Math.max(arr[n-1].value-arr[i].value,arr[i].value-arr[0].value);
}

for(var i=0;i<n;i++) {
  print(ans1[i] + " " + ans2[i]);
}

function main(n,arr) {

    var min = Infinity;
    var max = -Infinity;

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

        if(i === 0){
          min = Math.abs(arr[i+1] - arr[i]);
          max = Math.abs(arr[n-1] - arr[i]);
        }
        else if(i === n-1){
          min = Math.abs(arr[i - 1] - arr[i]);
          max = Math.abs(arr[0] - arr[i]);
        }
        else{
          min = Math.min(Math.abs(arr[i+1] - arr[i]),Math.abs(arr[i-1]-arr[i]))
          max = Math.max(Math.abs(arr[0] - arr[i]),Math.abs(arr[n-1]-arr[i]));
        }
        print(min + " " + max);
    }

}

var n = parseInt(readline());

var arr = readline().split(" ");
for(var i = 0 ; i < arr.length ; i++)arr[i] = parseInt(arr[i]);

main(n,arr)

var numberOfCities = Number(readline())
  var positions = readline().split(' ').map(Number)

  var prices = []
  var firstPrice = [
    Math.abs(positions[0] - positions[1]),
    Math.abs(positions[0] - positions[positions.length - 1]),
  ]

  prices.push(firstPrice)

  for (var i = 1; i < numberOfCities - 1; i++) {
    var price = [
      Math.min(
        Math.abs(positions[i] - positions[i - 1]),
        Math.abs(positions[i + 1] - positions[i])
      ),
      Math.max(
        Math.abs(positions[i] - positions[0]),
        Math.abs(positions[positions.length - 1] - positions[i])
      )
    ]

    prices.push(price)
  }

  var lastPrice = [
    Math.abs(positions[positions.length - 1] - positions[positions.length - 2]),
    Math.abs(positions[positions.length - 1] - positions[0]),
  ]

  prices.push(lastPrice)

  for (var i = 0; i < prices.length; i++) {
    print(prices[i].join(' '))
  }

var inputLength = readline();
var input =  readline().split(" ").map(x => parseInt(x));
if(inputLength == 1) {
	inputLength = 0;
	console.log(0);
}
var min, max;
for (var i = 0; i < inputLength; i++) {
  var distanceFromLeft = Math.abs(input[i - 1] - input[i]),
    distanceFromRight = Math.abs(input[i + 1] - input[i]),
    distanceFromFirst = Math.abs(input[0] - input[i]),
    distanceFromLast = Math.abs(input[inputLength - 1] - input[i]);
  if ((distanceFromLeft || Infinity) < (distanceFromRight || Infinity)) {
    min = distanceFromLeft;
  } else {
    min = distanceFromRight;
  }
  if ((distanceFromFirst || -Infinity) > (distanceFromLast || -Infinity)) {
    max = distanceFromFirst;
  } else {
    max = distanceFromLast;
  }
  print(min + ' ' + max);
}

var n = readline();
var a = readline().split(" ");
for(i = 0; i < n; i++){
    var min;
    var max;
    if(i == n -1){
        min = Math.abs(a[i] - a[i-1]);
        max = Math.abs(a[i] - a[0]);
        print(min + " " + max + "\n");
        break;
    }
    if(i == 0){
        min = Math.abs(a[i] - a[i+1]);
        max = Math.abs(a[i] - a[n-1]);
    }
    else{
        min = Math.min(Math.abs(a[i] - a[i+1]), Math.abs(a[i] - a[i-1]));
        max = Math.max(Math.abs(a[i] - a[0]), Math.abs(a[i] - a[n-1]));
    }
    print(min + " " + max + "\n");
}

var n = readline(), list = readline().split(' '), max, min
for (var i = 0 ; i < n; i++){
    if (i === 0) {
        min = Math.abs(list[i+1]-list[i])
        max = Math.abs(list[n-1]-list[i])
    }
    else if (i === n-1){
        min = Math.abs(list[i-1]-list[i])
        max = Math.abs(list[0]-list[i])
    }
    else {
        min = Math.min( Math.abs(list[i+1]-list[i]), Math.abs(list[i-1]-list[i]) )
        max = Math.max( Math.abs(list[n-1]-list[i]), Math.abs(list[0]-list[i]))
    }

    print(min + ' ' + max)
}

var n = readline()
var list = readline().split(' ')
for (var i = 0 ; i < n; i++){
    if (i === 0) {
        print(Math.abs(list[i+1]-list[i]) + ' ' + Math.abs(list[n-1]-list[i]))
    }
    else if (i === n-1){
        print(Math.abs(list[i-1]-list[i]) + ' ' + Math.abs(list[0]-list[i]))
    }
    else {
        print( Math.min( Math.abs(list[i+1]-list[i]), Math.abs(list[i-1]-list[i]) ) + ' ' + Math.max( Math.abs(list[n-1]-list[i]), Math.abs(list[0]-list[i])))
    }
}

//int n, *cit;
//	cin >> n;
//	cit = new int[n];
//	for (int i = 0; i < n; i++)
//	{
//		cin >> cit[i];
//	}
//
//	for (int i = 0; i < n; i++)
//	{
//
//		int max = abs(cit[i] - cit[n - 1]) > abs(cit[i] - cit[0]) ? abs(cit[i] - cit[n - 1]) : abs(cit[i] - cit[0]);
//		int min = 0, rgt, lft;
//
//		if (i == 0)
//		{
//			min = abs(cit[i] - cit[i + 1]);
//		}
//		else if (i == n - 1)
//		{
//			min = abs(cit[i] - cit[i - 1]);
//		}
//		else
//		{
//			min = abs(cit[i] - cit[i - 1]) < abs(cit[i] - cit[i + 1]) ? abs(cit[i] - cit[i - 1]) : abs(cit[i] - cit[i + 1]);
//		}
//
//		cout << min << " " << max << endl;
//	}

var n = readline();
n = parseInt(n);
var cits = readline().split(" ").map(function(x){ return parseInt(x); });
for(var i = 0; i < n; i++)
{
   var max = Math.abs(cits[i] - cits[n - 1]) > Math.abs(cits[i] - cits[0]) ? Math.abs(cits[i] - cits[n - 1]) : Math.abs(cits[i] - cits[0]);

    if(i == 0)
    {
       var min = Math.abs(cits[i] - cits[i + 1]);
    }
    else if (i == n - 1)
    {
        min = Math.abs(cits[i] - cits[i - 1]);
    }
    else
    {
        min = Math.abs(cits[i] - cits[i - 1]) < Math.abs(cits[i] - cits[i + 1]) ? Math.abs(cits[i] - cits[i - 1]) : Math.abs(cits[i] - cits[i + 1]);
    }

    print(min + " " + max);
}

var n = readline();
var dis = readline().split(" ");
var max = new Array(2);
var min = [];

for(var i = 0; i < n; i++){
	if(i-1>=0) min.push(parseInt(dis[i]-dis[i-1]));
	if(i+1<=n-1) min.push(parseInt(dis[i+1]-dis[i]));
	max[0] = parseInt(dis[i]-dis[0]);
	max[1] = parseInt(dis[n-1]-dis[i]);
	var s1 = (min.length == 2) ? (min[0] < min[1]) ? min[0] : min[1] : min[0];
	var s2 = (max[0] > max[1]) ? max[0] : max[1];
	print(s1 + " " + s2);
	min = [];
}

function main() {
	n = readline();
	cities = readline().split(" ");

	for (var i = 0; i < n; i++) {
		var min = cities[n-1] - cities[0];
		var max = 0;
				if (max < (cities[i] - cities[0])) {
			max = cities[i] - cities[0];
		}
		if (max < (cities[n-1] - cities[i])) {
			max = cities[n-1] - cities[i];
		}
		if (i > 0 && min > (cities[i] - cities[i-1])) {
			min = cities[i] - cities[i-1];
		}
		if (i+1 < n && min > (cities[i+1] - cities[i])) {
			min = cities[i+1] - cities[i];
		}

		write(min + " " + max + "\n");
	}
}

main();

function main() {
	n = readline();
	cities = readline().split(" ");

	for (var i = 0; i < n; i++) {
		var min = cities[n-1] - cities[0];
		var max = 0;
		if (i > 0 && min > (cities[i] - cities[i-1])) {
			min = cities[i] - cities[i-1];
		}
		if (i+1 < n && min > (cities[i+1] - cities[i])) {
			min = cities[i+1] - cities[i];
		}
		if (max < (cities[i] - cities[0])) {
			max = cities[i] - cities[0];
		}
		if (max < (cities[n-1] - cities[i])) {
			max = cities[n-1] - cities[i];
		}
		print(min + " " + max);
	}
}

main();

function main() {
	n = readline();
	cities = readline().split(" ");

	for (i = 0; i < n; i++) {
		min = cities[n-1] - cities[0];
		max = 0;

		if (i > 0 && min > (cities[i] - cities[i-1])) {
			min = cities[i] - cities[i-1];
		}
		if (i+1 < n && min > (cities[i+1] - cities[i])) {
			min = cities[i+1] - cities[i];
		}

		if (max < (cities[i] - cities[0])) {
			max = cities[i] - cities[0];
		}
		if (max < (cities[n-1] - cities[i])) {
			max = cities[n-1] - cities[i];
		}

		write(min + " " + max + "\n");
	}
}

main();

function main() {
	n = readline();
	cities = readline().split(" ");

	for (var i = 0; i < n; i++) {
		var min = cities[n-1] - cities[0];
		var max = 0;
				if (max < (cities[i] - cities[0])) {
			max = cities[i] - cities[0];
		}
		if (max < (cities[n-1] - cities[i])) {
			max = cities[n-1] - cities[i];
		}
		if (i > 0 && min > (cities[i] - cities[i-1])) {
			min = cities[i] - cities[i-1];
		}
		if (i+1 < n && min > (cities[i+1] - cities[i])) {
			min = cities[i+1] - cities[i];
		}

		print(min + " " + max);
	}
}

main();

function main() {
	n = readline();
	cities = readline().split(" ");

	for (var i = 0; i < n; i++) {
		var min = cities[n-1] - cities[0];
		var max = 0;

		if (i > 0 && min > (cities[i] - cities[i-1])) {
			min = cities[i] - cities[i-1];
		}
		if (i+1 < n && min > (cities[i+1] - cities[i])) {
			min = cities[i+1] - cities[i];
		}

		if (max < (cities[i] - cities[0])) {
			max = cities[i] - cities[0];
		}
		if (max < (cities[n-1] - cities[i])) {
			max = cities[n-1] - cities[i];
		}

		write(min + " " + max + "\n");
	}
}

main();

function main() {
	n = readline();
	cities = readline().split(" ");

	for (var i = 0; i < n; i++) {
		min = cities[n-1] - cities[0];
		max = 0;

		if (i > 0 && min > (cities[i] - cities[i-1])) {
			min = cities[i] - cities[i-1];
		}
		if (i+1 < n && min > (cities[i+1] - cities[i])) {
			min = cities[i+1] - cities[i];
		}

		if (max < (cities[i] - cities[0])) {
			max = cities[i] - cities[0];
		}
		if (max < (cities[n-1] - cities[i])) {
			max = cities[n-1] - cities[i];
		}

		write(min + " " + max + "\n");
	}
}

main();

function main(){

var line1 = readline();
var line2 = readline().split(' ').map(Number);

var n = parseInt(line1);

if(n===2){
    var str = '';

    str += (Math.abs(line2[0]-line2[1]));
    str += ' ';
    str += (Math.abs(line2[0]-line2[1]));

    print(str);
    print(str);

    return;
}

for(i=0;i<n;i++){
    var str = '';
    var min = 2000000000;
    var max = -2000000000;

    if(i!== 0){
	if(Math.abs(line2[i]-line2[i-1])<min){
	    min = Math.abs(line2[i]-line2[i-1]);
	}

	if(Math.abs(line2[i]-line2[0])>max){
	    max = Math.abs(line2[i]-line2[0]);
	}
    }

    if(i!== n-1){
	if(Math.abs(line2[i]-line2[i+1])<min){
	    min = Math.abs(line2[i]-line2[i+1]);
	}

	if(Math.abs(line2[i]-line2[n-1])>max){
	    max = Math.abs(line2[i]-line2[n-1]);
	}
    }

    str += min;
    str += ' ';
    str += max;

    print(str);
}
}
main();

readline()
T=readline().split(' ').map(x=>+x)
a=Math.abs,mi=Math.min,ma=Math.max,M=Number.MAX_VALUE,L=T.length
print(T.map((x,i)=>
  `${mi(i?a(T[i-1]-T[i]):M,(i<L-1)?a(T[i]-T[i+1]):M)} ` +
  `${ma(i?a(T[0]-T[i]):-M,(i<L-1)?a(T[i]-T[L-1]):-M)}`)
  .join('\n'))

readline()
T=readline().split(' ').map(x=>+x)
a=Math.abs,mi=Math.min,ma=Math.max
q=T.map((x,i)=>
  `${mi(i?a(T[i-1]-T[i]):Number.MAX_VALUE,(i<T.length-1)?a(T[i]-T[i+1]):Number.MAX_VALUE)} ` +
  `${ma(i?a(T[0]-T[i]):-Number.MAX_VALUE,(i<T.length-1)?a(T[i]-T[T.length-1]):-Number.MAX_VALUE)}`)
  .join('\n')
print(q)

readline()
T=readline().split(' ').map(x=>+x)
a=Math.abs,mi=Math.min,ma=Math.max,M=Number.MAX_VALUE
print(T.map((x,i)=>
  `${mi(i?a(T[i-1]-T[i]):M,(i<T.length-1)?a(T[i]-T[i+1]):M)} ` +
  `${ma(i?a(T[0]-T[i]):-M,(i<T.length-1)?a(T[i]-T[T.length-1]):-M)}`)
  .join('\n'))

function calculaDistancia(a,b) {
	var moduloA = Math.abs(a);
	var moduloB = Math.abs(b);
	if((a > 0 && b > 0) || (a < 0 && b < 0)) {
		return Math.abs(moduloA - moduloB);
	} else  {
		return Math.abs(moduloA + moduloB);
	}
}

var cidade = readline();
var arrayCidades = readline().split(" ").map(function(x) { return parseInt(x); });

var primeiro = arrayCidades[0];
var ultimo = arrayCidades[arrayCidades.length - 1];
for(var i = 0 ; i < arrayCidades.length ; i ++) {
	var valorCidade = arrayCidades[i];
	var menorDistancia;
    if ( i === 0 ) {
        menorDistancia = calculaDistancia(valorCidade, (arrayCidades.length >= 2 ? arrayCidades[i+1] : valorCidade));
    } else if ( i === arrayCidades.length - 1 ) {
        menorDistancia = calculaDistancia(valorCidade, (arrayCidades.length >= 2 ? arrayCidades[i-1] : valorCidade));
    } else {
    	var distanciaEsquerda = calculaDistancia(valorCidade, arrayCidades[i-1]);
    	var distanciaDireita = calculaDistancia(valorCidade, arrayCidades[i+1]);
    	menorDistancia = distanciaEsquerda > distanciaDireita ? distanciaDireita : distanciaEsquerda;
    }
    var maiorDistanciaEsquerda = calculaDistancia(primeiro, valorCidade);
    var maiorDistanciaDireita = calculaDistancia(ultimo, valorCidade);
    var maiorDistancia = maiorDistanciaEsquerda > maiorDistanciaDireita ? maiorDistanciaEsquerda : maiorDistanciaDireita;
    print(menorDistancia, maiorDistancia);
}

var citiesCount = parseInt(readline());
var places = readline().split(" ").map(Number);

for (var i = 0; i < places.length; i++) {
    var min = 0;
    var max = 0;

    // Min of 2 nearby values
    min = Math.min(
        Math.abs(places[i] - (i === 0 ? Infinity: places[i - 1])),
        Math.abs(places[i] - (i === places.length - 1 ? Infinity: places[i + 1]))
    );

    // Max of first and last value
    max = Math.max(
        Math.abs(places[i] - places[0]),
        Math.abs(places[i] - places[places.length - 1])
    )

    print(`${min} ${max}`);
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

function main() {
  // input
  const n = +readline();
  const a = readline().split(' ').map(x => parseInt(x));
  for (let i = 0; i < n; i++) {
    let min, max;
    if (i === 0) {
      min = a[i+1] - a[i];
      max = a[n-1] - a[0];
    } else if (i === n - 1) {
      min = a[i] - a[i-1];
      max = a[n-1] - a[0];
    } else {
      min = Math.min(a[i] - a[i-1], a[i+1] - a[i]);
      max = Math.max(a[i] - a[0], a[n-1] - a[i]);
    }
    print(`${min} ${max}\n`);
  }
}

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

let n
let miasta

rl.question('', (line) => {
  n = parseInt(line)
  rl.question('', (line) => {
    miasta = line.split(' ').map(Number)
    miasta.splice(0,0, Number.NEGATIVE_INFINITY)
    miasta.push(Number.POSITIVE_INFINITY)
    main()
  })
})

function main() {
  for (let i = 1; i<=n; i++) {
    minimum = Math.min(miasta[i]-miasta[i-1], miasta[i+1]-miasta[i])
    maximum = Math.max(miasta[i]-miasta[1], miasta[n]-miasta[i])
    console.log(minimum, maximum)
  }
  rl.close()
}

'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 readint() {
    let line = readline().split(' ').map(function(num) {
        return parseInt(num);
    });
    return line;
}

function readfloat() {
    let line = readline().split(' ').map(function(num) {
        return parseFloat(num);
    });
    return line;
}

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

function write(x) {
    process.stdout.write(x);
}
function min(a,b) {
    if(a > b) return b;
    else return a;
}
function min(a,b) {
    if(a > b) return b;
    else return a;
}
function max(a,b) {
    if(a > b) return a;
    else return b;
}
function main() {
    let [n] = readint();
    let x = readint();
    let mn, mx;
    let last = x.length - 1;
    for(let i = 0; i < last + 1; i++) {
        if(i == 0) {
            mn = x[1] - x[0];
            mx = x[last] - x[0];
        }
        else if(i == last) {
            mn = x[last] - x[last - 1];
            mx = x[last] - x[0];
        } else {
            mn = min((x[i] - x[i-1]), (x[i + 1] - x[i]));
            mx = max(x[i] - x[0], x[last] - x[i]);
        }
        write(mn + " " + mx + "\n");
    }
}

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

let n
let cities

rl.question('', (line) => {
  n = parseInt(line)
  rl.question('', (line) => {
    cities = line.split(' ').map(Number)
    cities.splice(0, 0, Number.NEGATIVE_INFINITY)
    cities.push(Number.POSITIVE_INFINITY)
    main()
  })
});

function main() {
  for (let i = 1; i <= n; ++i) {
    minimum = Math.min(cities[i] - cities[i-1], cities[i+1] - cities[i])
    maximum = Math.max(cities[i] - cities[1], cities[n] - cities[i])
    console.log(minimum, maximum)
  }

  rl.close();
}

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
let input = [];
readline.on('line', line => {
  input.push(line);
});
process.stdin.on('end', () => {
let secondLine = input[1].split(' ');
const n = parseInt(input[0], 10);
secondLine = secondLine.map((el) => parseInt(el, 10));

let text = '';
for (let i = 0; i< n; i++) {
  const current = secondLine[i];
  const right = secondLine[i + 1] !== undefined ? Math.abs(current-secondLine[i + 1]) : null;
  const left = secondLine[i - 1] !== undefined ? Math.abs(current-secondLine[i - 1]) : null;
  const minimum = right !== null && left !== null ? Math.min(right, left) : right || left;
  const maximum = Math.max(Math.abs(secondLine[0] - current), Math.abs(secondLine[n-1] - current))
  text += `${minimum} ${maximum}\n`
}
text = text.slice(0, text.length-1)
console.log(text);
});

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

let c = 0;

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

  let ans = "";
  const arr = d.split(" ").map(Number);

  for (let i = 0; i < arr.length; i++) {
    let minL = Math.abs(arr[i] - (arr[i - 1] || Infinity));
    let minR = Math.abs((arr[i + 1] || Infinity) - arr[i]);
    let min = Math.min(minL, minR);
    let maxL = Math.abs(arr[i] - arr[0]);
    let maxR = Math.abs(arr[arr.length - 1] - arr[i]);
    let max = Math.max(maxL, maxR);

    ans += `${min} ${max}\n`;
  }

  console.log(ans);

  c++;
});

const readline = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
let input = [];
readline.on('line', line => {
  input.push(line);
});
process.stdin.on('end', () => {
let secondLine = input[1].split(' ');
const n = parseInt(input[0], 10);
secondLine = secondLine.map((el) => parseInt(el, 10));

let text = '';
for (let i = 0; i< n; i++) {
  const current = secondLine[i];
  const right = secondLine[i + 1] ? Math.abs(current-secondLine[i + 1]) : null;
  const left = secondLine[i - 1] ? Math.abs(current-secondLine[i - 1]) : null;
  const minimum = right && left ? Math.min(right, left) : right || left;
  const maximum = Math.max(Math.abs(secondLine[0] - current), Math.abs(secondLine[n-1] - current))
  text += `${minimum} ${maximum}\n`
}
text = text.slice(0, text.length-1)
console.log(text);
});

var n = readline();
var dis = readline().split(" ");
var max = new Array(2);
var min = [];

for(var i = 0; i < 4; i++){
	if(i-1>=0) min.push(parseInt(dis[i]-dis[i-1]));
	if(i+1<=n-1) min.push(parseInt(dis[i+1]-dis[i]));
	max[0] = parseInt(dis[i]-dis[0]);
	max[1] = parseInt(dis[n-1]-dis[i]);
	var s1 = (min.length == 2) ? (min[0] < min[1]) ? min[0] : min[1] : min[0];
	var s2 = (max[0] > max[1]) ? max[0] : max[1];
	print(s1 + " " + s2);
	min = [];
}

function main(){

var line1 = readline();
var line2 = readline().split(' ').map(Number);

var n = parseInt(line1);

if(n===2){
    var str = '';

    str += (Math.abs(line2[0]-line2[1]));
    str += ' ';
    str += (Math.abs(line2[0]-line2[1]));

    print(str);
    print(str);

    return;
}

for(i=0;i<n;i++){
    var str = '';
    var min = 1000000000;
    var max = -1000000000;

    if(i!== 0){
	if(Math.abs(line2[i]-line2[i-1])<min){
	    min = Math.abs(line2[i]-line2[i-1]);
	}

	if(Math.abs(line2[i]-line2[0])>max){
	    max = Math.abs(line2[i]-line2[0]);
	}
    }

    if(i!== n-1){
	if(Math.abs(line2[i]-line2[i+1])<min){
	    min = Math.abs(line2[i]-line2[i+1]);
	}

	if(Math.abs(line2[i]-line2[n-1])>max){
	    max = Math.abs(line2[i]-line2[n-1]);
	}
    }

    str += min;
    str += ' ';
    str += max;

    print(str);
}
}
main();

var line1 = readline();
var line2 = readline().split(' ').map(Number);

var n = parseInt(line1);

for(i=0;i<n;i++){
    var str = '';
    var min = 1000000000;
    var max = -1000000000;

    for(j=0;j<n;j++){

	if(i===j){
	    continue;
	}
	if(Math.abs(line2[i]-line2[j])<min){
	    min = Math.abs(line2[i]-line2[j]);
	}
	if(Math.abs(line2[i]-line2[j])>max){
	    max = Math.abs(line2[i]-line2[j]);
	}
    }

    str += min;
    str += ' ';
    str += max;

    print(str);
}

var citiesCount = parseInt(readline());
var places = readline().split(" ").map(Number);

for (var i = 0; i < places.length; i++) {
    var min = 0;
    var max = 0;

    // Min of 2 nearby values
    min = Math.min(
        Math.abs(places[i] - (places[ i - 1] || -Infinity)),
        Math.abs(places[i] - (places[i + 1] || -Infinity))
    );

    // Max of first and last values
    max = Math.max(
        Math.abs(places[i] - places[0]),
        Math.abs(places[i] - places[places.length - 1])
    )

    print(`${min} ${max}`);
}

var citiesCount = parseInt(readline());
var places = readline().split(" ").map(Number);

for (var i = 0; i < places.length; i++) {
    var min = 0;
    var max = 0;

    // Min of 2 nearby values
    min = Math.min(
        Math.abs(places[i] - (places[ i - 1] || places[i])),
        Math.abs(places[i] - (places[i + 1] || places[i]))
    );

    // Max of first and last values
    max = Math.max(
        Math.abs(places[i] - places[0]),
        Math.abs(places[i] - places[places.length - 1])
    )

    print(`${min} ${max}`);
}

var citiesCount = parseInt(readline());
var places = readline().split(" ").map(Number);

for (var i = 0; i < places.length; i++) {
    var min = 0;
    var max = 0;

    // Min of 2 nearby values
    min = Math.min(
        Math.abs(places[i] - (places[ i - 1] || 0)),
        Math.abs(places[i] - (places[i + 1] || 0))
    );

    // Max of first and last values
    max = Math.max(
        Math.abs(places[i] - places[0]),
        Math.abs(places[i] - places[places.length - 1])
    )

    print(`${min} ${max}`);
}


'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(arr) {
  const n = arr.length;
  if (n % 2 === 0) {
    const b = (n/2) - 1;
    if (arr[b] <= b && arr[b+1] <= b) {
      return false;
    }
  }
  for(let i = 0; i < n; i++) {
    if (arr[i] < Math.min(i, n-i-1)) {
      return false;
    }
  }
  return true;
}

function main() {
  const t = parseInt(readline());
  for(let i = 0; i < t; i++) {
    readline();
    const arr = readline().split(' ');
    const res = solve(arr);
    console.log(res ? 'Yes' : 'No');
  }
}

var numRun= readline();

//zeroes are important and the number of units it is away from the end
//012343210 is an ideal array. as long as every digit is greater than the number it is from the end, it is ok
//3210 is ok; 0110 is not ok... need to find this example
//possible arrays could be 012345,543210,0123210
for(var n=0;n<numRun;n++){
    var k=readline();
    var s=readline().split(" ");
    var ans="No";
    if(checkUp(s)){ans="Yes";}
    if(checkDown(s)){ans="Yes";}
    if(checkMidOdd(s)){ans="Yes";}
    if(checkMidEven1(s)){ans="Yes";}
    if(checkMidEven2(s)){ans="Yes";}
    print(ans);
}//num runs

 //check left to right. Right-most can be 0 but then every other needs to be up 1
function checkUp(arr){
    for(var i=0;i<arr.length;i++){
        if(arr[i]>=i){}
        else{return false;}//one index is too low
    }//fpr
    return true;
}//checkUp

//right to left
function checkDown(arr){
    for(var i=0;i<arr.length;i++){
        if(arr[arr.length-1-i]>=i){}
        else{return false;}//one index is too low
    }//fpr
    return true;
}//checkUp

//check if it is a pyramid... highest index is in the middle
function checkMidOdd(arr){
        var mid=Math.floor(arr.length/2);
        for(var i=0;i<=mid;i++){
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

//check if it is a pyramid... highest index is in the middle
//high point will be arr.length/2-1 (for 4 array, index 1)
function checkMidEven1(arr){
        if(arr.length%2===1){return false;}
        var mid=Math.floor(arr.length/2);
        for(var i=0;i<=mid;i++){
            //print("index: "+i);
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
            //print("index: "+arr.length-1-i);
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

function checkMidEven2(arr){
        if(arr.length%2===1){return false;}
        var mid=Math.floor(arr.length/2)-1;
        if(arr[mid]<mid+1){return false;}
        for(var i=0;i<=mid;i++){
            //print("index: "+i);
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<=mid;i++){
            //print(arr.length-1-i);
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

function main() {
  var testCasesNum = +readline();
  for (var i = 0; i < testCasesNum; i++) {
    var len = +readline();
    var arr = readline()
      .split(" ")
      .map(Number);

    var left = findLeft(arr);
    var right = findRight(arr);
    if (left >= right) {
      print("Yes");
    } else {
      print("No");
    }
  }
}

function findLeft(arr) {
  var left = arr.length;
  for (var j = 0; j < arr.length; j++) {
    if (arr[j] < j) {
      left = j - 1;
      break;
    }
  }
  return left;
}

function findRight(arr) {
  var right = 0;
  for (var k = 0; k < arr.length; k++) {
    if (arr[arr.length - 1 - k] < k) {
      right = arr.length - k;
      break;
    }
  }
  return right;
}

main()

var numRun= readline();

//zeroes are important and the number of units it is away from the end
//012343210 is an ideal array. as long as every digit is greater than the number it is from the end, it is ok
//3210 is ok; 0110 is not ok... need to find this example
//possible arrays could be 012345,543210,0123210
for(var n=0;n<numRun;n++){
    var k=readline();
    var s=readline().split(" ");
    var ans="No";
    if(checkUp(s)){ans="Yes";}
    if(checkDown(s)){ans="Yes";}
    if(checkMidOdd(s)){ans="Yes";}
    if(checkMidEven1(s)){ans="Yes";}
    if(checkMidEven2(s)){ans="Yes";}
    print(ans);
}//num runs

 //check left to right. Right-most can be 0 but then every other needs to be up 1
function checkUp(arr){
    for(var i=0;i<arr.length;i++){
        if(arr[i]>=i){}
        else{return false;}//one index is too low
    }//fpr
    return true;
}//checkUp

//right to left
function checkDown(arr){
    for(var i=0;i<arr.length;i++){
        if(arr[arr.length-1-i]>=i){}
        else{return false;}//one index is too low
    }//fpr
    return true;
}//checkUp

//check if it is a pyramid... highest index is in the middle
function checkMidOdd(arr){
        var mid=Math.floor(arr.length/2);
        for(var i=0;i<=mid;i++){
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

//check if it is a pyramid... highest index is in the middle
//high point will be arr.length/2-1 (for 4 array, index 1)
function checkMidEven1(arr){
        if(arr.length%2===1){return false;}
        var mid=Math.floor(arr.length/2);
        if(arr[mid]<mid+1){return false;}
        for(var i=0;i<=mid;i++){
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

function checkMidEven2(arr){
        if(arr.length%2===1){return false;}
        var mid=Math.floor(arr.length/2)-1;
        if(arr[mid]<mid+1){return false;}
        for(var i=0;i<=mid;i++){
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

var numRun= readline();

//zeroes are important and the number of units it is away from the end
//012343210 is an ideal array. as long as every digit is greater than the number it is from the end, it is ok
//3210 is ok; 0110 is not ok... need to find this example
//possible arrays could be 012345,543210,0123210
for(var n=0;n<numRun;n++){
    var k=readline();
    var s=readline().split(" ");
    var ans="No";
    if(checkUp(s)){ans="Yes";}
    if(checkDown(s)){ans="Yes";}
    if(checkMidOdd(s)){ans="Yes";}
    if(checkMidEven(s)){ans="Yes";}
    print(ans);
}//num runs

 //check left to right. Right-most can be 0 but then every other needs to be up 1
function checkUp(arr){
    for(var i=0;i<arr.length;i++){
        if(arr[i]>=i){}
        else{return false;}//one index is too low
    }//fpr
    return true;
}//checkUp

//right to left
function checkDown(arr){
    for(var i=0;i<arr.length;i++){
        if(arr[arr.length-1-i]>=i){}
        else{return false;}//one index is too low
    }//fpr
    return true;
}//checkUp

//check if it is a pyramid... highest index is in the middle
function checkMidOdd(arr){
        var mid=Math.floor(arr.length/2);
        for(var i=0;i<=mid;i++){
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}

//check if it is a pyramid... highest index is in the middle
//high point will be arr.length/2-1 (for 4 array, index 1)
function checkMidEven(arr){
        if(arr.length%2===1){return false;}
        var mid=Math.floor(arr.length/2);
        if(arr[mid]>=mid&&arr[mid+1]>=mid){return false;}
        for(var i=0;i<=mid;i++){
            if(arr[i]>=i){}
            else{return false;}//one index is too low
        }
        for(var i=0;i<mid;i++){
             if(arr[arr.length-1-i]>=i){}
             else{return false;}//one index is too low
        }
    return true;
}


//var input = readline()
var t = parseInt(readline());
for(var i=0; i<t; i++) {
    var ar = readline().split(' ').map(x => parseInt(x));
    var a = ar[0], b = ar[1];
    print(b*2)
}

//

var t = Number(readline());
while(t--){
    w = readline().split(' ').map(x => Number(x));
    print(String(w[1] * 2) + '\n' );
}

let i = ''
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
    const { EOL } = require('os')
    let lines = i.split(EOL) /*your input text, split by lines*/
    const t = Number.parseInt(lines[0]);
    curInd = 0;
    for (let i = 0; i < t; ++i) {
        curInd += 1
        let line = lines[curInd].split(" ");
        const n = Number.parseInt(line[0]);
        const x = Number.parseInt(line[1]);
        console.log(x * 2);
    }
})

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

//Don't have to see. end------------------------------------------
function Main(){
  var t = nextInt();
  var output = new Array(t);
  for(var i = 0; i < t; i++){
    var tmp = nextIntArray();
    output[i] = tmp[1] * 2;
  }
  myout(myconv(output, 9));
}

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

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

  let [n, x] = d.split(' ').map(Number);
  console.log(x*2);

  c++;
});

const readline = require('readline');

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

var T;

rl.on("line", (line) => {
	if (T == null) T = parseInt(line);
	else {
		var x = parseInt(line.split(' ')[1]);
		console.log(x*2);
		T --;
		if (T == 0)
			rl.close();
	}
});

var queriesAmount = parseInt(readline())

for (var i = 0; i < queriesAmount; i++) {
  var nAndX = readline().split(' ').map(function(element) {
    return parseInt(element);
  });

  n = nAndX[0];
  x = nAndX[1];

  print(2 * x);
}

"use strict";

var main = function() {
    var T = +rd();
    while (T-->0) {
        var x = rdAr()[1];
        pr(x << 1);
    }
};

var rd = readline;
var wr = write;
var pr = print;
var rdAr = () => rd().split(' ').map(v => +v);
var prAr = (a) => pr(a.join(' '));
var cmpLt = (a, b) => a - b;
var cmpGt = (a, b) => b - a;

main();

var t = Number(readline());
while(t--){
    var w = readline().split(' ').map(x => Number(x));
    print(String(w[1] * 2) + '\n' );
}

var t = Number(readline());
while(t--){
    w = readline().split(' ').map(x => Number(x));
    print(String(w[1] * 2) + '\n' );
    delete w;
}


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, k] = rna();
		const s = rl();

		let ok = 1;
		for (let i = 0; i < k; i++) {
			ok = ok && s[i] == s[n-i-1];
		}

		console.log(ok && 2*k < n ? 'YES' : 'NO');
	}
}

///////////////////////////////// pre-define /////////////////////////////////////
const pr = console.log;
///////////////////////////////////////////////////////////////////////////////////

const solve = (n, k, s) => {
    if (k * 2 >= n) return pr('NO');
    let left = s.slice(0, k);
    let right = reverse2(s.slice(n - k));
    if (left == right) return pr('YES');
    pr('NO');
};

const reverse2 = (s) => {
    let res = "";
    for (let i = s.length - 1; i >= 0; i--) {
        res += s[i];
    }
    return res;
};

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);
    });
    rl.on('close', () => {
        let t = Number(input[0]);
        let i = 1;
        while (t--) {
            let tmp = input[i].split(" ").map(Number);
            solve(tmp[0], tmp[1], input[i + 1]);
            i += 2;
        }
    });
};

main()

///////////////////////////////// pre-define /////////////////////////////////////
const pr = console.log;
///////////////////////////////////////////////////////////////////////////////////

const solve = (n, k, s) => {
    if (k * 2 >= n) return pr('NO');
    let left = s.substr(0, k);
    let right = reverse2(s.substr(n - k, k));
    if (left == right) return pr('YES');
    pr('NO');
};

const reverse2 = (s) => {
    let res = "";
    for (let i = s.length - 1; i >= 0; i--) {
        res += s[i];
    }
    return res;
};

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);
    });
    rl.on('close', () => {
        let t = Number(input[0]);
        let i = 1;
        while (t--) {
            let tmp = input[i].split(" ").map(Number);
            solve(tmp[0], tmp[1], input[i + 1]);
            i += 2;
        }
    });
};

main()

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, k] = rna();
		const s = rl();

		let cnt = 0;
		for (let i = 0; i < Math.ceil(n/2)-1; i++) {
			if (s[i] == s[n-i-1]) cnt++;
			else break;
		}

		console.log(cnt >= k ? 'YES' : 'NO');
	}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main();
var mod = 1000000000n + 7n
var maxN = 1002

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

  Array(parseInt(x)).fill(1).map((t, iii) => {
    var [n, k] = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    var a = readline().split('').map((x, iii) => {
      return x
    })

    if (k === 0) return console.log('YES')
    if (n % 2 === 0 && n === k * 2) return console.log('NO')

    var isTrue = true
    // console.log(n, k)
    for (let i = 0; i < k; i++) {
// console.log(a[i], a[n-i-1], n-k+i-1)
      if(a[i] !== a[n-i-1]) isTrue = false
    }
// console.log(isTrue)
console.log(isTrue ? 'YES':'NO')

  })
}

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

  return gcd(b, a % b);
}

//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 K = nextInt();
		var s = next();
		if(K == 0){
			myout("YES");
			continue;
		}
		var count = 0;
		for(var j = 0; j < K; j++){
			if(s[j] == s[N - 1 - j]){
				count++;
			}else{
				break;
			}
		}
		if(count >= K){
			if(count == K && N / 2 == K && N % 2 == 0){
				myout("NO");
			}else{
				myout("YES");
			}

		}else{
			myout("NO");
		}
	}
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    var t = parseInt(readline());
    while(t-- > 0) {
        var n, k, s;

        [n, k] = readline().split(" ").map(s => parseInt(s));
        s = readline();

        if (2*k + 1 > s.length)
            console.log("NO");
        else {
            var ans = "YES";

            for (var i = 0; i < s.length/2; i++) {
                if (s[i] != s[s.length - i - 1]) {
                    if (i < k)
                        ans = "NO";
                    break;
                }
            }

            console.log(ans);
        }
    }
}

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 * 2
    } else if (count !== 0) {
        inputArr.push(data)
        count--
    }
    // max number 2^(53) - 1 ~~ 10^(15)
    if (count === 0) {
        // inputArr = inputArr.map(i => i.split(' ').map(j => j))
        main()
        process.exit(0)
    }
})

function solve([n, k], str) {
    if (k * 2 === n) return false
    let nstr = str.split('').reverse()
    for (let i = 0; i < k; i++) {
        if (str[i] !== nstr[i]) return false
    }
    return true
}

function main() {
    for (let i = 0; i < inputArr.length; i += 2) {
        let res = solve(inputArr[i].split(' ').map(j => +j), inputArr[i + 1])
        res ? console.log('YES') : console.log('NO')
    }
}

function getInt(num){
        return parseInt(num, 10)
    }

var t = parseInt(readline(), 10);
var lines= [];
for(var i = 0; i<t; i++){
    var line1 = readline().split(' ').map(getInt);
    var n = line1[0];
    var k = line1[1];
    cutPolindrom(readline(), k, n);
}

function cutPolindrom(str, k, n){
    var i = 0;
    var j = n - 1;
    while(i < j && str[i] == str[j]){
        i++;
        j--;
    }
    if(i>j){
        i=i-1;
        j=j+1
    }
    print(i >= k? 'YES' : 'NO');
}

///////////////////////////////// pre-define /////////////////////////////////////
const pr = console.log;
///////////////////////////////////////////////////////////////////////////////////

const solve = (n, k, s) => {
    if (k == 0) return pr('YES');
    for (let i = 0; i < n; i++) {
        let left = reverse2(s.slice(0, i));
        let right = s.slice(i + 1);
        if (left == right) return pr('YES');
    }
    pr('NO');
};

const reverse2 = (s) => {
    let res = "";
    for (let i = s.length - 1; i >= 0; i--) {
        res += s[i];
    }
    return res;
};

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);
    });
    rl.on('close', () => {
        let t = Number(input[0]);
        let i = 1;
        while (t--) {
            let tmp = input[i].split(" ").map(Number);
            solve(tmp[0], tmp[1], input[i + 1]);
            i += 2;
        }
    });
};

main()

///////////////////////////////// pre-define /////////////////////////////////////
const pr = console.log;
///////////////////////////////////////////////////////////////////////////////////

const solve = (n, k, s) => {
    if (k == 0) return pr('YES');
    for (let i = 0; i < n; i++) {
        let left = s.slice(0, i);
        let right = reverse2(s.slice(i + 1));
        if (left == right) return pr('YES');
    }
    pr('NO');
};

const reverse2 = (s) => {
    let res = "";
    for (let i = s.length - 1; i >= 0; i--) {
        res += s[i];
    }
    return res;
};

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);
    });
    rl.on('close', () => {
        let t = Number(input[0]);
        let i = 1;
        while (t--) {
            let tmp = input[i].split(" ").map(Number);
            solve(tmp[0], tmp[1], input[i + 1]);
            i += 2;
        }
    });
};

main()

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

// Make a Snippet for the code above this and then write your logic in main();
var mod = 1000000000n + 7n
var maxN = 1002

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

  Array(parseInt(x)).fill(1).map((t, iii) => {
    var [n, k] = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    })
    var a = readline().split('').map((x, iii) => {
      return x
    })

    if (k === 0) return console.log('YES')
    if (n % 2 === 0 && n === k * 2) return console.log('NO')

    var isTrue = true
    // console.log(n, k)
    for (let i = 0; i < k+1; i++) {
// console.log(a[i], a[n-i-1], n-k+i-1)
      if(a[i] !== a[n-i-1]) isTrue = false
    }
// console.log(isTrue)
console.log(isTrue ? 'YES':'NO')

  })
}

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

  return gcd(b, a % b);
}

//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 K = nextInt();
		var s = next();
		if(K == 0){
			myout("YES");
			continue;
		}
		var count = 0;
		for(var j = 0; j < K; j++){
			if(s[j] == s[N - 1 - j]){
				count++;
			}else{
				break;
			}
		}
		if(count >= K){
			if(count == K && N % 2 == 0){
				myout("NO");
			}else{
				myout("YES");
			}

		}else{
			myout("NO");
		}
	}
}