As you know, all the kids in Berland love playing with cubes. Little Petya has n towers consisting of cubes of the same size. Tower with number i consists of ai cubes stacked one on top of the other. Petya defines the instability of a set of towers as a value equal to the difference between the heights of the highest and the lowest of the towers. For example, if Petya built five cube towers with heights (8, 3, 2, 6, 3), the instability of this set is equal to 6 (the highest tower has height 8, the lowest one has height 2). The boy wants the instability of his set of towers to be as low as possible. All he can do is to perform the following operation several times: take the top cube from some tower and put it on top of some other tower of his set. Please note that Petya would never put the cube on the same tower from which it was removed because he thinks it's a waste of time. Before going to school, the boy will have time to perform no more than k such operations. Petya does not want to be late for class, so you have to help him accomplish this task.

The first line contains two space-separated positive integers n and k (1 ≤ n ≤ 100, 1 ≤ k ≤ 1000) — the number of towers in the given set and the maximum number of operations Petya can perform. The second line contains n space-separated positive integers ai (1 ≤ ai ≤ 104) — the towers' initial heights.

In the first line print two space-separated non-negative integers s and m (m ≤ k). The first number is the value of the minimum possible instability that can be obtained after performing at most k operations, the second number is the number of operations needed for that. In the next m lines print the description of each operation as two positive integers i and j, each of them lies within limits from 1 to n. They represent that Petya took the top cube from the i-th tower and put in on the j-th one (i ≠ j). Note that in the process of performing operations the heights of some towers can become equal to zero. If there are multiple correct sequences at which the minimum possible instability is achieved, you are allowed to print any of them.

NoteIn the first sample you need to move the cubes two times, from the second tower to the third one and from the second one to the first one. Then the heights of the towers are all the same and equal to 6.

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;

var a = readline().split(' ').map(function(x){return parseInt(x);});

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;
	var maxInd = 0;
	var minInd = 0;

	while(step < k){
		for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

		var div = a[maxInd] - a[minInd];

		if (div == 0){
			break;
		}

		if (div == 1){
				break;
		}

		var numsD = 0;

		a[minInd]++;
		a[maxInd]--;
		step++;
		moves.push("" + (maxInd + 1) + " " + (minInd+1));
	}

	for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

	print((a[maxInd] - a[minInd]) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var st = readline().split(" ");
var abc = readline().split(" ");
//var n = 3;
var k = parseInt(st[1]);
var abb = [];
var min;
var max;
var idMin = 0;
var idMax = 0;
var str1 = "";
var strM = "";
var m = 0;
for (i in abc){
abc[i]=parseInt(abc[i]);
abb[i]=parseInt(abc[i]);
}
for (z=0;z<k;z++){
	mi(abc);
	ma(abc);
	if(abc[idMax-1]-abc[idMin-1]>1){
		abc[idMax-1] = abc [idMax-1]-1;
		abc[idMin-1] = abc [idMin-1]+1;
		m++;
		mi(abc);
		ma(abc);
	}
}
str1 = abc[idMax-1]-abc[idMin-1] + " " + m;
print(str1);
for (z=0;z<k;z++){
	mi(abb);
	ma(abb);
	if(abb[idMax-1]-abb[idMin-1]>1){
		abb[idMax-1] = abb [idMax-1]-1;
		abb[idMin-1] = abb [idMin-1]+1;
		m++;
		strM = idMax + " " + idMin;
		print(strM);
	}
}

function mi(x){
	min = 10000000;
	idMin = 0;
	for (i in x){
		if (x[i]<min) {min = x[i];
		idMin = parseInt(i)+1;
		}
	}
}
function ma(y){
	max = 0;
	idMax = 0;
	for (j in y){
		if (y[j]>max) {max = y[j];
		idMax = parseInt(j)+1;
		}
	}
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;
var sortF = function(a,b){return a > b;};

var a_ = readline().split(' ').map(function(x){return parseInt(x);});
var sum = 0;

var a = [];
for(var i=0; i < n; i++)
{
	a[i] = {v: a_[i],
			ind: i+1};
	sum+=a_[i];
}

a.sort(function(x, y){return x.v > y.v;})

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;

	while(step < k){
		var div = a[n-1].v - a[0].v;

		if (div == 0){
			break;
		}

		if (div == 1){
				break;
		}

		a[0].v++;
		a[n-1].v--;
		step++;
		moves.push("" + a[n-1].ind + " " + a[0].ind);

		a.sort(function(x, y){return x.v > y.v;})
		// if (a[n-1].v < a[n-2].v){
			// var t = a[n-2];
			// a[n-2] = a[n-1];
			// a[n-1] = t;
		// }

		// if (a[0].v > a[1].v){
			// var t = a[1];
			// a[1] = a[0];
			// a[0] = t;
		// }
	}
	print((a[n-1].v - a[0].v) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;

var a = readline().split(' ').map(function(x){return parseInt(x);});

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;
	var maxInd = 0;
	var minInd = 0;

	while(step < k){
		for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

		var div = a[maxInd] - a[minInd];

		if (div == 0){
			break;
		}

		if (div == 1){
				break;
		}

		var numsD = 0;

		a[minInd]++;
		a[maxInd]--;
		step++;
		moves.push("" + a[n-1] + " " + a[0]);
	}

	for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

	print((a[maxInd] - a[minInd]) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;
var sortF = function(a,b){return a > b;};

var a_ = readline().split(' ').map(function(x){return parseInt(x);});
var sum = 0;

var a = [];
for(var i=0; i < n; i++)
{
	a[i] = {v: a_[i],
			ind: i+1};
	sum+=a_[i];
}

a.sort(function(x, y){return x.v > y.v;})

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;

	while(step < k){
		var div = a[n-1].v - a[0].v;

		if (div == 0){
			break;
		}

		if (div == 1){
				break;
		}

		var numsD = 0;
		for(var j=0; j < Math.floor(n/2); j++){
			if (a[n-j-1].v - a[j].v == div) numsD++;
		}
		if (numsD > k) break;

		a[0].v++;
		a[n-1].v--;
		step++;
		moves.push("" + a[n-1].ind + " " + a[0].ind);

		a.sort(function(x, y){return x.v > y.v;})
		// if (a[n-1].v < a[n-2].v){
			// var t = a[n-2];
			// a[n-2] = a[n-1];
			// a[n-1] = t;
		// }

		// if (a[0].v > a[1].v){
			// var t = a[1];
			// a[1] = a[0];
			// a[0] = t;
		// }
	}
	print((a[n-1].v - a[0].v) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;
var sortF = function(a,b){return a > b;};

var a_ = readline().split(' ').map(function(x){return parseInt(x);});
var sum = 0;

var a = [];
for(var i=0; i < n; i++)
{
	a[i] = {v: a_[i],
			ind: i+1};
	sum+=a_[i];
}

a.sort(function(x, y){return x.v > y.v;})

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;

	while(step < k){
		var div = a[n-1].v - a[0].v;

		if (div == 0){
			break;
		}

		if (div == 1){
			if (sum % n != 0){
				break;
			}
		}

		a[0].v++;
		a[n-1].v--;
		step++;
		moves.push("" + a[n-1].ind + " " + a[0].ind);

		a.sort(function(x, y){return x.v > y.v;})
		// if (a[n-1].v < a[n-2].v){
			// var t = a[n-2];
			// a[n-2] = a[n-1];
			// a[n-1] = t;
		// }

		// if (a[0].v > a[1].v){
			// var t = a[1];
			// a[1] = a[0];
			// a[0] = t;
		// }
	}
	print((a[n-1].v - a[0].v) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;

var a = readline().split(' ').map(function(x){return parseInt(x);});

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;
	var maxInd = 0;
	var minInd = 0;

	while(step < k){
		for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

		var div = a[maxInd] - a[minInd];

		if (div == 0){
			break;
		}

		if (div == 1){
				break;
		}

		var numsD = 0;

		a[minInd]++;
		a[maxInd]--;
		step++;
		moves.push("" + a[n-1].ind + " " + a[0].ind);
	}

	for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

	print((a[maxInd] - a[minInd]) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;
var sortF = function(a,b){return a > b;};

var a_ = readline().split(' ').map(function(x){return parseInt(x);});
var sum = 0;

var a = [];
for(var i=0; i < n; i++)
{
	a[i] = {v: a_[i],
			ind: i+1};
	sum+=a_[i];
}

a.sort(function(x, y){return x.v > y.v;})

var moves = [];

if (n==1) {
	print(a[n] + " " + 0);
}
else {
	var step = 0;

	while(step < k){
		var div = a[n-1].v - a[0].v;

		if (div == 0){
			break;
		}

		if (div == 1){
			if (sum % n != 0){
				break;
			}
		}

		a[0].v++;
		a[n-1].v--;
		step++;
		moves.push("" + a[n-1].ind + " " + a[0].ind);

		a.sort(function(x, y){return x.v > y.v;})
		// if (a[n-1].v < a[n-2].v){
			// var t = a[n-2];
			// a[n-2] = a[n-1];
			// a[n-1] = t;
		// }

		// if (a[0].v > a[1].v){
			// var t = a[1];
			// a[1] = a[0];
			// a[0] = t;
		// }
	}
	print((a[n-1].v - a[0].v) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;

var a = readline().split(' ').map(function(x){return parseInt(x);});

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;
	var maxInd = 0;
	var minInd = 0;

	while(step < k){
		for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

		var div = a[maxInd] - a[minInd];

		if (div == 0){
			break;
		}

		if (div == 1){
				break;
		}

		var numsD = 0;

		a[minInd]++;
		a[maxInd]--;
		step++;
		moves.push("" + maxInd + " " + minInd);
	}

	for(var i=0; i < n; i++){
			if (a[minInd] > a[i]) minInd = i;
			if (a[maxInd] < a[i]) maxInd = i;
		}

	print((a[maxInd] - a[minInd]) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var inp = readline().split(' ').map(function(x){return parseInt(x);});
var n = inp[0], k = inp[1];

var M = Math;
var sortF = function(a,b){return a > b;};

var a_ = readline().split(' ').map(function(x){return parseInt(x);});
var sum = 0;

var a = [];
for(var i=0; i < n; i++)
{
	a[i] = {v: a_[i],
			ind: i+1};
	sum+=a_[i];
}

a.sort(function(x, y){return x.v > y.v;})

var moves = [];

if (n==1) {
	print(0 + " " + 0);
}
else {
	var step = 0;

	while(step < k){
		var div = a[n-1].v - a[0].v;

		if (div == 0){
			print(0 + " " + step);
			break;
		}

		if (div == 1){
			if (sum % n != 0){
				print(1 + " " + step);
				break;
			}
		}

		a[0].v++;
		a[n-1].v--;
		step++;
		moves.push("" + a[n-1].ind + " " + a[0].ind);

		a.sort(function(x, y){return x.v > y.v;})
		// if (a[n-1].v < a[n-2].v){
			// var t = a[n-2];
			// a[n-2] = a[n-1];
			// a[n-1] = t;
		// }

		// if (a[0].v > a[1].v){
			// var t = a[1];
			// a[1] = a[0];
			// a[0] = t;
		// }
	}
	if ((a[n-1].v - a[0].v) > 1)
		print((a[n-1].v - a[0].v) + " " + step);
	for(var i=0; i < moves.length; i++)
		print(moves[i]);
}

var st = readline().split(" ");
var abc = readline().split(" ");
//var n = 3;
var k = parseInt(st[1]);
var abb = [];
var min;
var max;
var idMin = 0;
var idMax = 0;
var str1 = "";
var strM = "";
var m = 0;
for (i in abc){
abc[i]=parseInt(abc[i]);
abb[i]=parseInt(abc[i]);
}
for (z=0;z<k;z++){
	mi(abc);
	ma(abc);
	if(abc[idMax-1]-abc[idMin-1]>1){
		abc[idMax-1] = abc [idMax-1]-1;
		abc[idMin-1] = abc [idMin-1]+1;
		m++;
	}
}
str1 = abc[idMax-1]-abc[idMin-1] + " " + m;
print(str1);
for (z=0;z<k;z++){
	mi(abb);
	ma(abb);
	if(abb[idMax-1]-abb[idMin-1]>1){
		abb[idMax-1] = abb [idMax-1]-1;
		abb[idMin-1] = abb [idMin-1]+1;
		m++;
		strM = idMax + " " + idMin;
		print(strM);
	}
}

function mi(x){
	min = 10000000;
	idMin = 0;
	for (i in x){
		if (x[i]<min) {min = x[i];
		idMin = parseInt(i)+1;
		}
	}
}
function ma(y){
	max = 0;
	idMax = 0;
	for (j in y){
		if (y[j]>max) {max = y[j];
		idMax = parseInt(j)+1;
		}
	}
}

var st = readline().split(" ");
var abc = readline().split(" ");
//var n = 3;
var k = parseInt(st[1]);
var abb = [];
var min;
var max;
var idMin = 0;
var idMax = 0;
var str1 = "";
var strM = "";
var m = 0;
for (i in abc){
abc[i]=parseInt(abc[i]);
abb[i]=parseInt(abc[i]);
}
for (z=0;z<k;z++){
	mi(abc);
	ma(abc);
	if(abc[idMax-1]-abc[idMin-1]>1){
		abc[idMax-1] = abc [idMax-1]-1;
		abc[idMin-1] = abc [idMin-1]+1;
		m++
	}
}
str1 = abc[idMax-1]-abc[idMin-1] + " " + m;
print(str1);
for (z=0;z<k;z++){
	mi(abb);
	ma(abb);
	if(abb[idMax-1]-abb[idMin-1]>1){
		abb[idMax-1] = abb [idMax-1]-1;
		abb[idMin-1] = abb [idMin-1]+1;
		m++;
		strM = idMax + " " + idMin;
		print(strM);
	}
}

function mi(x){
	min = 101;
	idMin = 0;
	for (i in x){
		if (x[i]<min) {min = x[i];
		idMin = parseInt(i)+1;
		}
	}
}
function ma(y){
	max = 0;
	idMax = 0;
	for (j in y){
		if (y[j]>max) {max = y[j];
		idMax = parseInt(j)+1;
		}
	}
}


Ridbit starts with an integer $$$n$$$.In one move, he can perform one of the following operations:   divide $$$n$$$ by one of its proper divisors, or  subtract $$$1$$$ from $$$n$$$ if $$$n$$$ is greater than $$$1$$$. A proper divisor is a divisor of a number, excluding itself. For example, $$$1$$$, $$$2$$$, $$$4$$$, $$$5$$$, and $$$10$$$ are proper divisors of $$$20$$$, but $$$20$$$ itself is not.What is the minimum number of moves Ridbit is required to make to reduce $$$n$$$ to $$$1$$$?

The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$) — the number of test cases. The only line of each test case contains a single integer $$$n$$$ ($$$1 \leq n \leq 10^9$$$).

For each test case, output the minimum number of moves required to reduce $$$n$$$ to $$$1$$$.

NoteFor the test cases in the example, $$$n$$$ may be reduced to $$$1$$$ using the following operations in sequence$$$1$$$$$$2 \xrightarrow{} 1$$$$$$3 \xrightarrow{} 2 \xrightarrow{} 1$$$$$$4 \xrightarrow{} 2 \xrightarrow{} 1$$$$$$6 \xrightarrow{} 2 \xrightarrow{} 1$$$$$$9 \xrightarrow{} 3 \xrightarrow{} 2\xrightarrow{} 1$$$

'use strict'

let t = readline();

while(t--)
{
    let n = readline();
    if(n<3)
    {
        print(n-1);
        continue;
    }
    let c = 0;
    for(let i = 2; i <= Math.sqrt(n); i++)
    {
        if(n%i==0)
        {
            n = i;
            c++;
            break;
        }
        if((--n)%i==0)
        {
            n = i;
            c+=2;
            break;
        }
    }
    while(n != 1)
    {
        n--;
        c++;
    }
    print(c);
}

var tt = parseInt(readline());
for(; tt--;){
    var  number = parseInt(readline());
    var res = (number==1) ?0:(number==2) ? 1 : (2+number%2-(number==3));
    print(res)
}

var tc = parseInt(readline());
for (; tc--;){
    var n = parseInt(readline());
    if (n % 2 == 0) {
        if (n > 2) print(2);
        else print(1);
    }
    else {
        if (n >= 5) print(3);
        else if (n == 3) print(2);
        else print(0);
    }
}

const solve = (n) => {
    if (n == 1) return 0;
    if (n == 2) return 1;
    if (n == 3) return 2;
    if (n % 2 == 0) {
        return 2;
    } else {
        return 3;
    }
};

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

main()

// 'use strict';

let inputString = [];
let currentLine = 0;

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

function readNumberLine () {
  return readLine().replace(/\s+$/, '').split(' ').map(val => parseInt(val));
}

function readStringLine () {
  return readLine().replace(/\s+$/, '').split(' ').map(val => String(val));
}

function readCharLine () {
  return readLine().replace(/\s+$/, '').split('').map(val => String(val));
}

if (process.env.ROCKNROLL) {
  // const fs = require('fs');
  // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
  //
  // const buffer = fs.readFileSync(process.env.INPUT_PATH, { encoding: 'utf8' });
  //
  // inputString = buffer.split('\n');
  //
  // execution.then(() => ws.end());
  // setTimeout(main, 0); //main();
}
else {
  process.stdin.resume().setEncoding('utf-8');

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

  process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    // execution.then(() => ws.end());
    main();
  });
}

const MOD = 1000000007;

const alpha = 'abcdefghijklmnopqrstuvwxyz'.split('');
const alphaBig = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');

function main() {
  let [tc] = readNumberLine();

  while (tc--) {
    let [n] = readNumberLine();
    let res = 0;

   if (n > 1) {
     if (n === 2) {
       res = 1;
     }
     else if (n % 2 === 0) {
       res = 2;
     }
     else {
       if (n === 3) {
         res = 2;
       }
       else {
         res = 3;
       }
     }
   }

    console.log(`${res}`);
  }

  // endExecution();
}

// module.exports = execution;

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

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

function main() {
  let t = +readLine();
  while (t--) {
    const n = +readLine();
    if (n === 1) console.log(0);
    else if (n === 2) console.log(1);
    else if (n === 3 || n % 2 === 0) console.log(2);
    else console.log(3);
  }
}

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

    A();
});

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

function pi(a) {
    return parseInt(a);
}

function ti(a){
    for(let i = 0; i < a.length; i++)
        a[i] = pi(a[i]);

    return a;
}

function A(){
    let t = pi(readline());
    while(t > 0){
        t--;
        let n = pi(readline());
        if(n%2 === 0){
            if(n === 2){
                console.log(1)
            }else{
                console.log(2);
            }
        }else if(n === 1){
            console.log(0);
        }else{
            if(n === 3){
                console.log(2);
            }else{
                console.log(3);
            }
        }
    }
}

'use strict'

let t = readline();

while(t--)
{
    let n = readline();
    if(n<3)
    {
        print(n-1);
        continue;
    }
    let c = 0;
    for(let i = 2; i <= Math.sqrt(n); i++)
    {
        if(n%i==0)
        {
            n = i;
            c++;
            break;
        }
    }
    while(n != 1)
    {
        n--;
        c++;
    }
print(c);
}

var tt = parseInt(readline());
for(; tt--;){
    var  number = parseInt(readline());
    var res = (number==1) ?0:(number==2) ? 1 : (1+number%2-(number==3));
    print(res)
}

// 'use strict';

let inputString = [];
let currentLine = 0;

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

function readNumberLine () {
  return readLine().replace(/\s+$/, '').split(' ').map(val => parseInt(val));
}

function readStringLine () {
  return readLine().replace(/\s+$/, '').split(' ').map(val => String(val));
}

function readCharLine () {
  return readLine().replace(/\s+$/, '').split('').map(val => String(val));
}

if (process.env.ROCKNROLL) {
  // const fs = require('fs');
  // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
  //
  // const buffer = fs.readFileSync(process.env.INPUT_PATH, { encoding: 'utf8' });
  //
  // inputString = buffer.split('\n');
  //
  // execution.then(() => ws.end());
  // setTimeout(main, 0); //main();
}
else {
  process.stdin.resume().setEncoding('utf-8');

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

  process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    // execution.then(() => ws.end());
    main();
  });
}

const MOD = 1000000007;

const alpha = 'abcdefghijklmnopqrstuvwxyz'.split('');
const alphaBig = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');

function main() {
  let [tc] = readNumberLine();

  while (tc--) {
    let [n] = readNumberLine();
    let res = 0;

    while (n > 1) {
      const upperBound = Math.floor(Math.sqrt(n));
      let done = false;
      for (let i = upperBound; i > 1; i--) {
        if (n % i === 0) {
          done = true;
          n = n / Math.max(i, n / i);
          res++;
          break;
        }
      }

      if (!done) {
        n--;
        res++;
      }
    }

    console.log(`${res}`);
  }

  // endExecution();
}

// module.exports = execution;

// 'use strict';

let inputString = [];
let currentLine = 0;

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

function readNumberLine () {
  return readLine().replace(/\s+$/, '').split(' ').map(val => parseInt(val));
}

function readStringLine () {
  return readLine().replace(/\s+$/, '').split(' ').map(val => String(val));
}

function readCharLine () {
  return readLine().replace(/\s+$/, '').split('').map(val => String(val));
}

if (process.env.ROCKNROLL) {
  // const fs = require('fs');
  // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);
  //
  // const buffer = fs.readFileSync(process.env.INPUT_PATH, { encoding: 'utf8' });
  //
  // inputString = buffer.split('\n');
  //
  // execution.then(() => ws.end());
  // setTimeout(main, 0); //main();
}
else {
  process.stdin.resume().setEncoding('utf-8');

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

  process.stdin.on('end', function() {
    inputString = inputString.split('\n');

    // execution.then(() => ws.end());
    main();
  });
}

const MOD = 1000000007;

const alpha = 'abcdefghijklmnopqrstuvwxyz'.split('');
const alphaBig = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');

function main() {
  let [tc] = readNumberLine();

  while (tc--) {
    let [n] = readNumberLine();
    let res = 0;

    while (n > 1) {
      const upperBound = Math.floor(Math.sqrt(n));
      let done = false;
      for (let i = 2; i <= upperBound; i++) {
        if (n % i === 0) {
          done = true;
          n = n / Math.max(i, n / i);
          res++;
          break;
        }
      }

      if (!done) {
        n--;
        res++;
      }
    }

    console.log(`${res}`);
  }

  // endExecution();
}

// module.exports = execution;


Little X used to play a card game called "24 Game", but recently he has found it too easy. So he invented a new game.Initially you have a sequence of n integers: 1, 2, ..., n. In a single step, you can pick two of them, let's denote them a and b, erase them from the sequence, and append to the sequence either a + b, or a - b, or a × b.After n - 1 steps there is only one number left. Can you make this number equal to 24?

The first line contains a single integer n (1 ≤ n ≤ 105).

If it's possible, print "YES" in the first line. Otherwise, print "NO" (without the quotes). If there is a way to obtain 24 as the result number, in the following n - 1 lines print the required operations an operation per line. Each operation should be in form: "a op b = c". Where a and b are the numbers you've picked at this operation; op is either "+", or "-", or "*"; c is the result of corresponding operation. Note, that the absolute value of c mustn't be greater than 1018. The result of the last operation must be equal to 24. Separate operator sign and equality sign from numbers with spaces. If there are multiple valid answers, you may print any of them.

function ProblemSolver() {

    this.rec = function( arr , callCounter ) {
        var i , sz , j , k , newArr , a , b , c , d , res , r1 , newCallCounter;
        res = false;
        sz = arr.length;
        newCallCounter = callCounter + 1;
        if( callCounter > this.n - 1 ) {
            return res;
        }
        if( callCounter == this.n - 1 && sz > 1 ) {
            return res;
        }
        if( sz == 1 ) {
            if( arr[ 0 ] == 24 && callCounter == this.n - 1 ) {
                res = true;
            }
            return res;
        }
        for( i = 0 ; i < sz ; i++ ) {
            for( j = i + 1 ; j < sz ; j++ ) {
                a = arr[ i ] * arr[ j ];
                b = arr[ i ] + arr[ j ];
                c = arr[ i ] - arr[ j ];
                d = arr[ j ] - arr[ i ];
                newArr = new Array();
                for( k = 0 ; k < sz ; k++ ) {
                    if( k != i && k != j ) {
                        newArr.push( arr[ k ] );
                    }
                }
                newArr.push( a );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = a;
                    this.srr[ this.cn ] = "*";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                newArr.push( b );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = b;
                    this.srr[ this.cn ] = "+";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                newArr.push( c );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = c;
                    this.srr[ this.cn ] = "-";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                if( c != d ) {
                    newArr.push( d );
                    r1 = this.rec( newArr , newCallCounter );
                    if( r1 == true ) {
                        this.arr[ this.cn ] = arr[ j ];
                        this.brr[ this.cn ] = arr[ i ];
                        this.crr[ this.cn ] = d;
                        this.srr[ this.cn ] = "-";
                        this.cn++;
                        res = true;
                        return res;
                    }
                }
            }
        }
        return res;
    };

    this.solveCase = function() {
        var res , i , j , arr;
        arr = new Array();
        if( this.n < 4 ) {
            print( "NO" );
            return;
        }
        print( "YES" );
        if( this.n > 8 ) {
            print( "1 * 2 = 2" );
            print( "3 * 4 = 12" );
            print( "2 * 12 = 24" );
            print( "5 - 6 = -1" );
            print( "7 - 8 = -1" );
            print( "-1 - -1 = 0" );
            for( i = 9 ; i <= this.n ; i++ ) {
                print( "0 * " + i + " = 0" );
            }
            print( "24 + 0 = 24" );
            return;
        }
        for( i = 1 ; i <= this.n ; i++ ) {
            arr.push( i );
        }
        this.cn = 0;
        res = this.rec( arr , 0 );
        for( i = this.cn - 1 ; i >= 0 ; i-- ) {
            print( this.arr[ i ] + " " + this.srr[ i ] + " " + this.brr[ i ] + " = " + this.crr[ i ] );
        }
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.brr = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        //this.clearArraysPerCase() ;
    };

    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.crr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.crr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.memsetArray1D = function( arrParam , val ) {
        var i;
        if( arrParam == null ) {
            throw new Error( "No array supplied in the parameter!" );
        }
        if( val == null ) {
            throw new Error( "No value for memset has been supplied in the parameter!" );
        }
        arrParam = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            arrParam.push( val );
        }
        return arrParam;
    };

    this.getStringLength = function( stringData ) {
        var len , lengthType;
        len = stringData.length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = stringData.length();
        }
        else {
            len = stringData.length;
        }
        return len;
    };

    this.init();
}

function InputReader() {
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhinoStdin = function() {
        importPackage( java.io );
        importPackage( java.lang );
        var singleLine , reader;
        reader = new BufferedReader( new InputStreamReader( System[ "in" ] ) );
        this.allLines = [];
        while( true ) {
            singleLine = reader.readLine();
            if( singleLine != null ) {
                this.allLines.push( singleLine );
            }
            else {
                break;
            }
        }
    };

    this.readAllLinesFromNodeStdin = function() {
        var fsObj , size , rawData;
        process.stdin.setEncoding( 'ascii' );
        fsObj = require( 'fs' );
        size = fsObj.fstatSync( process.stdin.fd ).size;
        rawData = fsObj.readSync( process.stdin.fd , size )[ 0 ];
        this.parseRawData( rawData );
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx , lengthType;
        len = this.allLines[ this.currrentLineNumber ].length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = this.allLines[ this.currrentLineNumber ].length();
        }
        if( flag == 0 ) {
            res = "";
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != '\t'.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = -1;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) || this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == '\t'.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            if( endIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            else {
                this.currrentCharacterIndex = endIdx;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        if( currentDirectory.charAt( 1 ) != ":" ) {
            //not local machine/windows
            outputFilePath = outputFileName;
        }
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCode = function() {
        var testCases , i , hasMoreTestCases , isLocalMachine , localContext;
        isLocalMachine = false;
        try {
            if( __dirname != null && __dirname.charAt( 1 ) == ':' ) {
                //only on windows
                isLocalMachine = true;
            }
        }
        catch( ex ) {
            isLocalMachine = false;
        }
        if( isLocalMachine == true ) {
            //local machine runs on node and relies on file i/o
            print = console.log;
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
        }
        else {
            //server machine
            try {
                var rlObj = readline;
                //server runs on javasctipt v8 distribution and has readline method on global context
                this.irObj.readAllLines();
            }
            catch( ex ) {
                try {
                    var pObj = process;
                    //server runs on node
                    print = console.log;
                    this.irObj.readAllLinesFromNodeStdin();
                }
                catch( ex ) {
                    try {
                        var ipObj = importPackage;
                        //server runs on rhino
                        this.irObj.readAllLinesFromRhinoStdin();
                    }
                    catch( ex ) {
                        throw new Error( "Unknown javasctipt distribution!" );
                    }
                }
            }
        }
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            //only works for local machine(tested)
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.runCode();
}

new CodeExecutioner();

var n = parseInt(readline()),
			initN = n;

		n % 2 == 0 ? n = evenMake24(n) : n = oddMake24(n);

		function evenMake24(n)	{
			if(n < 4)	{
				print('NO');
				return -1;
			}

			print('YES');
			for(var i = 1; i < 4; i+=2)		{
				var text = eqToString(i, i + 1, i * (i + 1), '*');

				print(text);
			}

			print(eqToString(2, 12, 2 * 12, '*'));

			for(var i = 5; i < n + 1; i+=2)	{
				if(i >= initN)	print(eqToString(24, 1, 24 * 1, '*'));
				else	print(eqToString(i + 1, i, i + 1 - i, '-'));

				n += 1;
			}
		};

		function oddMake24(n)	{
			if(n < 5)	{
				print('NO');
				return -1;
			}

			print('YES');

			print(eqToString(5, 4, 5 * 4, '*'));
			print(eqToString(3, 2, 3 + 2, '+'));
			print(eqToString(5, 1, 5 - 1, '-'));
			print(eqToString(20, 4, 20 + 4, '+'));

			for(var i = 6; i < n + 1; i+=2)	{
				if(i >= initN)	print(eqToString(24, 1, 24 * 1, '*'));
				else	print(eqToString(i + 1, i, i + 1 - i, '-'));

				n += 1;
			}
		};

		function eqToString(num1, num2, rst, op)	{
			return num1 + ' ' + op + ' ' + num2 + ' = ' + rst;
		};

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    console.log("YES");
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  console.log("2 * 4 = 8\n3 * 8 = 24\n1 * 24 = 24");
  for (let i = 5; i < n; i += 2) {
    console.log(`${i + 1} - ${i} = 1`);
    console.log(`1 * 24 = 24`);
  }
}
//处理n为奇数情况
function processOdd(n) {
  console.log("4 * 5 = 20\n3 - 1 = 2\n2 + 2 = 4\n20 + 4 = 24");
  for (let i = 6; i < n; i += 2) {
    console.log(`${i + 1} - ${i} = 1`);
    console.log(`1 * 24 = 24`);
  }
}

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    console.log("YES");
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  console.log("2 * 4 = 8");
  console.log("3 * 8 = 24");
  console.log("1 * 24 = 24");
  for (let i = 5; i < n; i += 2) {
    console.log(`${i + 1} - ${i} = 1`);
    console.log(`1 * 24 = 24`);
  }
}
//处理n为奇数情况
function processOdd(n) {
  console.log("4 * 5 = 20");
  console.log("3 - 1 = 2");
  console.log("2 + 2 = 4");
  console.log("20 + 4 = 24");
  for (let i = 6; i < n; i += 2) {
    console.log(`${i + 1} - ${i} = 1`);
    console.log(`1 * 24 = 24`);
  }
}

// Generated by CoffeeScript 1.7.1
(function() {
  var console, make, x;

  make = function(x) {
    var i, _i;
    if (x < 4) {
      console.log('NO');
    } else {
      console.log('YES');
    }
    if (x === 4) {
      console.log('4 * 3 = 12');
      console.log('12 * 2 = 24');
      console.log('24 * 1 = 24');
    }
    if (x === 5) {
      console.log('1 + 2 = 3');
      console.log('3 * 4 = 12');
      console.log('5 - 3 = 2');
      console.log('12 * 2 = 24');
    }
    if (x > 5) {
      console.log('2 * 3 = 6');
      console.log('6 * 4 = 24');
      console.log('5 - 6 = -1');
      console.log('1 + -1 = 0');
      if (x !== 6) {
        for (i = _i = 7; 7 <= x ? _i <= x : _i >= x; i = 7 <= x ? ++_i : --_i) {
          console.log("0 * " + i + " = 0");
        }
      }
      return console.log("24 + 0 = 24");
    }
  };

  console = {};

  console.log = print;

  x = parseInt(readline(), 10);

  make(x);

}).call(this);

function ProblemSolver() {

    this.rec = function( arr , callCounter ) {
        var i , sz , j , k , newArr , a , b , c , d , res , r1 , newCallCounter;
        res = false;
        sz = arr.length;
        newCallCounter = callCounter + 1;
        if( callCounter > this.n - 1 ) {
            return res;
        }
        if( callCounter == this.n - 1 && sz > 1 ) {
            return res;
        }
        if( sz == 1 ) {
            if( arr[ 0 ] == 24 && callCounter == this.n - 1 ) {
                res = true;
            }
            return res;
        }
        for( i = 0 ; i < sz ; i++ ) {
            for( j = i + 1 ; j < sz ; j++ ) {
                a = arr[ i ] * arr[ j ];
                b = arr[ i ] + arr[ j ];
                c = arr[ i ] - arr[ j ];
                d = arr[ j ] - arr[ i ];
                newArr = new Array();
                for( k = 0 ; k < sz ; k++ ) {
                    if( k != i && k != j ) {
                        newArr.push( arr[ k ] );
                    }
                }
                newArr.push( a );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = a;
                    this.srr[ this.cn ] = "*";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                newArr.push( b );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = b;
                    this.srr[ this.cn ] = "+";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                newArr.push( c );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = c;
                    this.srr[ this.cn ] = "-";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                if( c != d ) {
                    newArr.push( d );
                    r1 = this.rec( newArr , newCallCounter );
                    if( r1 == true ) {
                        this.arr[ this.cn ] = arr[ j ];
                        this.brr[ this.cn ] = arr[ i ];
                        this.crr[ this.cn ] = d;
                        this.srr[ this.cn ] = "-";
                        this.cn++;
                        res = true;
                        return res;
                    }
                }
            }
        }
        return res;
    };

    this.solveCase = function() {
        var res , i , j , arr;
        arr = new Array();
        if( this.n < 4 ) {
            print( "NO" );
        }
        if( this.n > 8 ) {
            print( "1 * 2 = 2" );
            print( "3 * 4 = 12" );
            print( "2 * 12 = 24" );
            print( "5 - 6 = -1" );
            print( "7 - 8 = -1" );
            print( "-1 - -1 = 0" );
            for( i = 9 ; i <= this.n ; i++ ) {
                print( "0 * " + i + " = 0" );
            }
            print( "24 + 0 = 24" );
            return;
        }
        for( i = 1 ; i <= this.n ; i++ ) {
            arr.push( i );
        }
        this.cn = 0;
        res = this.rec( arr , 0 );
        for( i = this.cn - 1 ; i >= 0 ; i-- ) {
            print( this.arr[ i ] + " " + this.srr[ i ] + " " + this.brr[ i ] + " = " + this.crr[ i ] );
        }
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.brr = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        //this.clearArraysPerCase() ;
    };

    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.crr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.crr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.memsetArray1D = function( arrParam , val ) {
        var i;
        if( arrParam == null ) {
            throw new Error( "No array supplied in the parameter!" );
        }
        if( val == null ) {
            throw new Error( "No value for memset has been supplied in the parameter!" );
        }
        arrParam = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            arrParam.push( val );
        }
        return arrParam;
    };

    this.getStringLength = function( stringData ) {
        var len , lengthType;
        len = stringData.length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = stringData.length();
        }
        else {
            len = stringData.length;
        }
        return len;
    };

    this.init();
}

function InputReader() {
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhinoStdin = function() {
        importPackage( java.io );
        importPackage( java.lang );
        var singleLine , reader;
        reader = new BufferedReader( new InputStreamReader( System[ "in" ] ) );
        this.allLines = [];
        while( true ) {
            singleLine = reader.readLine();
            if( singleLine != null ) {
                this.allLines.push( singleLine );
            }
            else {
                break;
            }
        }
    };

    this.readAllLinesFromNodeStdin = function() {
        var fsObj , size , rawData;
        process.stdin.setEncoding( 'ascii' );
        fsObj = require( 'fs' );
        size = fsObj.fstatSync( process.stdin.fd ).size;
        rawData = fsObj.readSync( process.stdin.fd , size )[ 0 ];
        this.parseRawData( rawData );
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx , lengthType;
        len = this.allLines[ this.currrentLineNumber ].length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = this.allLines[ this.currrentLineNumber ].length();
        }
        if( flag == 0 ) {
            res = "";
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != '\t'.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = -1;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) || this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == '\t'.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            if( endIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            else {
                this.currrentCharacterIndex = endIdx;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        if( currentDirectory.charAt( 1 ) != ":" ) {
            //not local machine/windows
            outputFilePath = outputFileName;
        }
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCode = function() {
        var testCases , i , hasMoreTestCases , isLocalMachine , localContext;
        isLocalMachine = false;
        try {
            if( __dirname != null && __dirname.charAt( 1 ) == ':' ) {
                //only on windows
                isLocalMachine = true;
            }
        }
        catch( ex ) {
            isLocalMachine = false;
        }
        if( isLocalMachine == true ) {
            //local machine runs on node and relies on file i/o
            print = console.log;
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
        }
        else {
            //server machine
            try {
                var rlObj = readline;
                //server runs on javasctipt v8 distribution and has readline method on global context
                this.irObj.readAllLines();
            }
            catch( ex ) {
                try {
                    var pObj = process;
                    //server runs on node
                    print = console.log;
                    this.irObj.readAllLinesFromNodeStdin();
                }
                catch( ex ) {
                    try {
                        var ipObj = importPackage;
                        //server runs on rhino
                        this.irObj.readAllLinesFromRhinoStdin();
                    }
                    catch( ex ) {
                        throw new Error( "Unknown javasctipt distribution!" );
                    }
                }
            }
        }
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            //only works for local machine(tested)
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.runCode();
}

new CodeExecutioner();

function ProblemSolver() {

    this.rec = function( arr , callCounter ) {
        var i , sz , j , k , newArr , a , b , c , d , res , r1 , newCallCounter;
        res = false;
        sz = arr.length;
        newCallCounter = callCounter + 1 ;
        if( callCounter > this.n - 1 ) {
            return res ;
        }
        if( callCounter == this.n - 1 && sz > 1 ) {
            return res ;
        }
        if( sz == 1 ) {
            if( arr[ 0 ] == 24 && callCounter == this.n - 1 ) {
                res = true;
            }
            return res;
        }
        for( i = 0 ; i < sz ; i++ ) {
            for( j = i + 1 ; j < sz ; j++ ) {
                a = arr[ i ] * arr[ j ];
                b = arr[ i ] + arr[ j ];
                c = arr[ i ] - arr[ j ];
                d = arr[ j ] - arr[ i ];
                newArr = new Array();
                for( k = 0 ; k < sz ; k++ ) {
                    if( k != i && k != j ) {
                        newArr.push( arr[ k ] );
                    }
                }
                newArr.push( a );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = a;
                    this.srr[ this.cn ] = "*";
                    this.cn++;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                newArr.push( b );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = b;
                    this.srr[ this.cn ] = "+";
                    this.cn++ ;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                newArr.push( c );
                r1 = this.rec( newArr , newCallCounter );
                if( r1 == true ) {
                    this.arr[ this.cn ] = arr[ i ];
                    this.brr[ this.cn ] = arr[ j ];
                    this.crr[ this.cn ] = c;
                    this.srr[ this.cn ] = "-";
                    this.cn++ ;
                    res = true;
                    return res;
                }
                newArr.splice( newArr.length - 1 , 1 );
                if( c != d ) {
                    newArr.push( d );
                    r1 = this.rec( newArr , newCallCounter );
                    if( r1 == true ) {
                        this.arr[ this.cn ] = arr[ j ];
                        this.brr[ this.cn ] = arr[ i ];
                        this.crr[ this.cn ] = d;
                        this.srr[ this.cn ] = "-";
                        this.cn++ ;
                        res = true;
                        return res;
                    }
                }
            }
        }
        return res;
    };

    this.solveCase = function() {
        var res , i , j , arr;
        arr = new Array();
        if( this.n > 8 ) {
            print( "1 * 2 = 2" );
            print( "3 * 4 = 12" );
            print( "2 * 12 = 24" );
            print( "5 - 6 = -1" );
            print( "7 - 8 = -1" );
            print( "-1 - -1 = 0" );
            for( i = 9 ; i <= this.n ; i++ ) {
                print( "0 * " + i + " = 0" );
            }
            print( "24 + 0 = 24" );
            return ;
        }
        for( i = 1 ; i <= this.n ; i++ ) {
            arr.push( i );
        }
        this.cn = 0;
        res = this.rec( arr , 0 );
        for( i = this.cn - 1 ; i >= 0 ; i-- ) {
            print( this.arr[ i ] + " " + this.srr[ i ] + " " + this.brr[ i ] + " = " + this.crr[ i ] );
        }
    };

    this.getInput = function( irObj ) {
        var hasMoreInput , i;
        hasMoreInput = true;
        try {
            this.n = irObj.nextInt();
        }
        catch( ex ) {
            hasMoreInput = false;
        }
        return hasMoreInput;
    };

    this.clearArraysPerCase = function() {
        var i;
        this.arr = new Array();
        this.brr = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.adj_list.push( new Array() );
        }
    };

    this.clearPerCase = function() {
        this.cn = 0;
        this.cc++;
        //this.clearArraysPerCase() ;
    };

    this.HAS_TEST_CASES = false;
    this.INPUT_FILE_NAME = "test.in";
    this.OUTPUT_FILE_NAME = "out.txt";
    this.DO_OUTPUT_TO_FILE = false;

    this.declareAndFillArrays = function() {
        var i , j;
        this.srr = new Array();
        this.vis = new Array();
        this.arr = new Array();
        this.brr = new Array();
        this.crr = new Array();
        this.memo = new Array();
        this.done = new Array();
        this.adj_list = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            this.srr.push( "" );
            this.vis.push( 0 );
            this.arr.push( 0 );
            this.brr.push( 0 );
            this.crr.push( 0 );
            this.adj_list.push( new Array() );
        }
        for( i = 0 ; i < this.lim2 ; i++ ) {
            this.memo.push( new Array() );
            this.done.push( new Array() );
            for( j = 0 ; j < this.lim2 ; j++ ) {
                this.memo[ i ].push( -1 );
                this.done[ i ].push( 0 );
            }
        }
    };

    this.init = function() {
        this.lim1 = 100010;
        this.lim2 = 110;
        this.cc = 1;
        this.ind = 1;
        this.n = 0;
        this.cn = 0;
        this.declareAndFillArrays();
    };

    this.memsetArray1D = function( arrParam , val ) {
        var i;
        if( arrParam == null ) {
            throw new Error( "No array supplied in the parameter!" );
        }
        if( val == null ) {
            throw new Error( "No value for memset has been supplied in the parameter!" );
        }
        arrParam = new Array();
        for( i = 0 ; i < this.lim1 ; i++ ) {
            arrParam.push( val );
        }
        return arrParam;
    };

    this.getStringLength = function( stringData ) {
        var len , lengthType;
        len = stringData.length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = stringData.length();
        }
        else {
            len = stringData.length;
        }
        return len;
    };

    this.init();
}

function InputReader() {
    this.allLines = new Array();
    this.currrentLineNumber = 0;
    this.currrentCharacterIndex = 0;

    this.readAllLines = function() {
        var singleLine;
        while( true ) {
            try {
                singleLine = readline();
                if( singleLine == null ) {
                    break;
                }
            }
            catch( ex ) {
                break;
            }
            this.allLines.push( singleLine );
        }
    };

    this.readAllLinesFromRhinoStdin = function() {
        importPackage( java.io );
        importPackage( java.lang );
        var singleLine , reader;
        reader = new BufferedReader( new InputStreamReader( System[ "in" ] ) );
        this.allLines = [];
        while( true ) {
            singleLine = reader.readLine();
            if( singleLine != null ) {
                this.allLines.push( singleLine );
            }
            else {
                break;
            }
        }
    };

    this.readAllLinesFromNodeStdin = function() {
        var fsObj , size , rawData;
        process.stdin.setEncoding( 'ascii' );
        fsObj = require( 'fs' );
        size = fsObj.fstatSync( process.stdin.fd ).size;
        rawData = fsObj.readSync( process.stdin.fd , size )[ 0 ];
        this.parseRawData( rawData );
    };

    this.parseRawData = function( data ) {
        var len , i , currentString;
        len = data.length;
        currentString = "";
        for( i = 0 ; i < len ; i++ ) {
            if( data[ i ] == '\r' ) {
            }
            else if( data[ i ] == '\n' ) {
                this.allLines.push( currentString );
                currentString = "";
            }
            else {
                currentString += data[ i ];
            }
        }
        if( currentString != "" ) {
            this.allLines.push( currentString );
        }
    };

    this.readAllLinesFromFile = function( inputFileName ) {
        var currentDirectory , fsObj , inputFilePath , rawData;
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        inputFilePath = currentDirectory + "\\" + inputFileName;
        rawData = fsObj.readFileSync( inputFilePath , "utf8" );
        this.parseRawData( rawData );
    };

    this.next = function( flag ) {
        var len , i , startIdx , res , endIdx , lengthType;
        len = this.allLines[ this.currrentLineNumber ].length;
        lengthType = typeof len;
        if( lengthType == "function" ) {
            len = this.allLines[ this.currrentLineNumber ].length();
        }
        if( flag == 0 ) {
            res = "";
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            this.currrentLineNumber++;
            this.currrentCharacterIndex = 0;
            return res;
        }
        while( true ) {
            if( this.currrentLineNumber >= this.allLines.length ) {
                throw new Error( "No more tokens available!" );
            }
            startIdx = -1;
            for( i = this.currrentCharacterIndex ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != ' '.charCodeAt( 0 ) && this.allLines[ this.currrentLineNumber ].charCodeAt( i ) != '\t'.charCodeAt( 0 ) ) {
                    startIdx = i;
                    break;
                }
            }
            if( startIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
                continue;
            }
            res = "";
            endIdx = -1;
            for( i = startIdx ; i < len ; i++ ) {
                if( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == ' '.charCodeAt( 0 ) || this.allLines[ this.currrentLineNumber ].charCodeAt( i ) == '\t'.charCodeAt( 0 ) ) {
                    endIdx = i;
                    break;
                }
                res += String.fromCharCode( this.allLines[ this.currrentLineNumber ].charCodeAt( i ) );
            }
            if( endIdx == -1 ) {
                this.currrentLineNumber++;
                this.currrentCharacterIndex = 0;
            }
            else {
                this.currrentCharacterIndex = endIdx;
            }
            return res;
        }
    };

    this.nextInt = function() {
        return parseInt( this.next( 1 ) );
    };

    this.nextDouble = function() {
        return parseFloat( this.next( 1 ) );
    };

    this.nextString = function() {
        return this.next( 1 );
    };

    this.nextLine = function() {
        this.next( 0 );
    };
}

function FileOutputHandler() {
    this.resultantStringArray = new Array();

    this.addNewLine = function( newString ) {
        this.resultantStringArray.push( newString );
    };

    this.clearPercase = function() {
        this.resultantStringArray = new Array();
    };

    this.flushOutOutputToFile = function( outputFileName ) {
        var i , sz , res , currentDirectory , fsObj , outputFilePath;
        res = "";
        sz = this.resultantStringArray.length;
        for( i = 0 ; i < sz ; i++ ) {
            if( i != 0 ) {
                res += "\n";
            }
            res += this.resultantStringArray[ i ];
        }
        fsObj = require( 'fs' );
        currentDirectory = __dirname;
        outputFilePath = currentDirectory + "\\" + outputFileName;
        if( currentDirectory.charAt( 1 ) != ":" ) {
            //not local machine/windows
            outputFilePath = outputFileName;
        }
        fsObj.writeFileSync( outputFilePath , res );
        this.clearPercase();
    };
}

function CodeExecutioner() {
    this.irObj = new InputReader();
    this.psObj = new ProblemSolver();
    this.fohObj = new FileOutputHandler();

    this.runCode = function() {
        var testCases , i , hasMoreTestCases , isLocalMachine , localContext;
        isLocalMachine = false;
        try {
            if( __dirname != null && __dirname.charAt( 1 ) == ':' ) {
                //only on windows
                isLocalMachine = true;
            }
        }
        catch( ex ) {
            isLocalMachine = false;
        }
        if( isLocalMachine == true ) {
            //local machine runs on node and relies on file i/o
            print = console.log;
            if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
                localContext = this.fohObj;
                print = function() {
                    localContext.addNewLine.apply( localContext , arguments );
                }
            }
            this.irObj.readAllLinesFromFile( this.psObj.INPUT_FILE_NAME );
        }
        else {
            //server machine
            try {
                var rlObj = readline;
                //server runs on javasctipt v8 distribution and has readline method on global context
                this.irObj.readAllLines();
            }
            catch( ex ) {
                try {
                    var pObj = process;
                    //server runs on node
                    print = console.log;
                    this.irObj.readAllLinesFromNodeStdin();
                }
                catch( ex ) {
                    try {
                        var ipObj = importPackage;
                        //server runs on rhino
                        this.irObj.readAllLinesFromRhinoStdin();
                    }
                    catch( ex ) {
                        throw new Error( "Unknown javasctipt distribution!" );
                    }
                }
            }
        }
        if( this.psObj.HAS_TEST_CASES == true ) {
            testCases = this.irObj.nextInt();
            for( i = 0 ; i < testCases ; i++ ) {
                this.psObj.clearPerCase();
                this.psObj.getInput( this.irObj );
                this.psObj.solveCase();
            }
        }
        else {
            while( true ) {
                this.psObj.clearPerCase();
                hasMoreTestCases = this.psObj.getInput( this.irObj );
                if( hasMoreTestCases == false ) {
                    break;
                }
                this.psObj.solveCase();
            }
        }
        if( this.psObj.DO_OUTPUT_TO_FILE == true ) {
            //only works for local machine(tested)
            this.fohObj.flushOutOutputToFile( this.psObj.OUTPUT_FILE_NAME );
        }
    };

    this.runCode();
}

new CodeExecutioner();

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    console.log("YES");
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  console.log("2 * 4 = 8");
  console.log("3 * 8 = 24");
  console.log("1 * 24 = 24");
  for (let i = 5; i < n; i += 2) {
    console.log(`${i + 1}-${i} = 1`);
    console.log(`1 * 24 = 24`);
  }
}
//处理n为奇数情况
function processOdd(n) {
  console.log("4 * 5 = 20");
  console.log("3 - 1 = 2");
  console.log("2 + 2 = 4");
  console.log("20 + 4 = 24");
  for (let i = 6; i < n; i += 2) {
    console.log(`${i + 1}-${i} = 1`);
    console.log(`1 * 24 = 24`);
  }
}

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  let data = "YES\n2 * 4 = 8\n3 * 8 = 24\n1 * 24 = 24\n";
  for (let i = 5; i < n; i += 2) {
    data.concat(i + 1 + " - " + i + " = " + "1");
  }
  console.log(data);
}
//处理n为奇数情况
function processOdd(n) {
  let data = "YES\n4 * 5 = 20\n3 - 1 = 2\n2 + 2 = 4\n20 + 4 = 24\n";
  for (let i = 6; i < n; i += 2) {
    data.concat(i + 1 + " - " + i + " = " + "1");
  }
  console.log(data);
}

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  let data = "YES\n2 * 4 = 8\n3 * 8 = 24\n1 * 24 = 24\n";
  for (let i = 5; i < n - 2; i += 2) {
    data += `${i + 1} - ${i} = 1\n`;
  }
  data += `${n} - ${n - 1} = 1`;
  console.log(data);
}
//处理n为奇数情况
function processOdd(n) {
  let data = "YES\n4 * 5 = 20\n3 - 1 = 2\n2 + 2 = 4\n20 + 4 = 24\n";
  for (let i = 6; i < n - 2; i += 2) {
    data += `${i + 1} - ${i} = 1\n`;
  }
  data += `${n} - ${n - 1} = 1`;
  console.log(data);
}

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  let data = "YES\n2 * 4 = 8\n3 * 8 = 24\n1 * 24 = 24\n";
  for (let i = 5; i < n; i += 2) {
    data.concat(`${i + 1} - ${i} = 1\n`);
  }
  console.log(data);
}
//处理n为奇数情况
function processOdd(n) {
  let data = "YES\n4 * 5 = 20\n3 - 1 = 2\n2 + 2 = 4\n20 + 4 = 24\n";
  for (let i = 6; i < n; i += 2) {
    data.concat(`${i + 1} - ${i} = 1`);
  }
  console.log(data);
}

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  let data = "YES\n2 * 4 = 8\n3 * 8 = 24\n1 * 24 = 24\n";
  for (let i = 5; i < n - 2; i += 2) {
    data += `${i + 1} - ${i} = 1\n`;
  }
  data += `${n} - ${n - 1} = 1`;
  console.log(data);
  console.log("");
}
//处理n为奇数情况
function processOdd(n) {
  let data = "YES\n4 * 5 = 20\n3 - 1 = 2\n2 + 2 = 4\n20 + 4 = 24\n";
  for (let i = 6; i < n - 2; i += 2) {
    data += `${i + 1} - ${i} = 1\n`;
  }
  data += `${n} - ${n - 1} = 1`;
  console.log(data);
  console.log("");
}

const processData = (lines) => {
  const n = +lines[0];
  if (n <= 3) console.log("NO");
  else {
    n % 2 === 0 ? processEven(n) : processOdd(n);
  }
};
//处理输入
let data = "";
process.stdin.on("data", (c) => (data += c));
process.stdin.on("end", () => {
  const { EOL } = require("os"); //获取换行符
  const lines = data.split(EOL);
  processData(lines);
});

//处理n为偶数情况
function processEven(n) {
  let data = "YES\n2 * 4 = 8\n3 * 8 = 24\n1 * 24 = 24\n";
  for (let i = 5; i < n; i += 2) {
    data += `${i + 1} - ${i} = 1\n`;
  }
  console.log(data);
}
//处理n为奇数情况
function processOdd(n) {
  let data = "YES\n4 * 5 = 20\n3 - 1 = 2\n2 + 2 = 4\n20 + 4 = 24\n";
  for (let i = 6; i < n; i += 2) {
    data += `${i + 1} - ${i} = 1\n`;
  }
  console.log(data);
}

// Generated by CoffeeScript 1.7.1
(function() {
  var console, make, x;

  make = function(x) {
    var i, zeros, _i;
    if (x < 4) {
      console.log('NO');
    } else {
      console.log('YES');
    }
    if (x === 4) {
      console.log('4 * 3 = 12');
      console.log('12 * 2 = 24');
      console.log('24 * 1 = 24');
    }
    if (x === 5) {
      console.log('1 + 2 = 3');
      console.log('3 * 4 = 12');
      console.log('5 - 3 = 2');
      console.log('12 * 2 = 24');
    }
    if (x > 5) {
      console.log('2 * 3 = 6');
      console.log('6 * 4 = 24');
      console.log('5 - 6 = -1');
      console.log('1 + -1 = 0');
      zeros = 0;
      for (i = _i = 7; 7 <= x ? _i <= x : _i >= x; i = 7 <= x ? ++_i : --_i) {
        console.log("0 * " + i + " = 0");
        zeros++;
      }
      return console.log("24 + 0 = 24");
    }
  };

  console = {};

  console.log = print;

  x = parseInt(readline(), 10);

  make(x);

}).call(this);


At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite set of Picks.Fortunately, Picks remembers something about his set S:  its elements were distinct integers from 1 to limit;  the value of  was equal to sum; here lowbit(x) equals 2k where k is the position of the first one in the binary representation of x. For example, lowbit(100102) = 102, lowbit(100012) = 12, lowbit(100002) = 100002 (binary representation). Can you help Picks and find any set S, that satisfies all the above conditions?

The first line contains two integers: sum, limit (1 ≤ sum, limit ≤ 105).

In the first line print an integer n (1 ≤ n ≤ 105), denoting the size of S. Then print the elements of set S in any order. If there are multiple answers, print any of them. If it's impossible to find a suitable set, print -1.

NoteIn sample test 1: lowbit(4) = 4, lowbit(5) = 1, 4 + 1 = 5.In sample test 2: lowbit(1) = 1, lowbit(2) = 2, lowbit(3) = 1, 1 + 2 + 1 = 4.

var x = readline().trim().split(' ').map((_x)=>parseInt(_x))
var s = x[0],l = x[1];
var a = s;
var bits = []
var ans=[];
var available =[]
while(a>0){
    bits.push(a%2);
    a=parseInt(a/2)
}

for(var i=0;i<=l;i++){
    available.push(1)
}

var p =bits.length-1;
var pp = parseInt(Math.pow(2,p))
var has = true;
while(bits.length>0){p
    if(bits[p]==0){
        p--;
        pp=parseInt(pp/2);
        if(p==-1)
            break;
        continue;
    }
    var w = pp;
    var find = false;
    while(w<=l){

        if(available[w]==1){
            available[w]=0;
            ans.push(w)
            find=true;
            bits[p]--;
            break;
        }
        w+=2*pp
    }
    if(!find)
    {
        if(p>0){
            bits[p-1]+=2;
            bits[p]--;
        }else{
            has = false;
            break;
        }

    }
}
if(has){
    print(ans.length)
    print(ans.join(' '))
}else{
    print(-1)
}

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

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

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

function main() {
	var data = tokenizeIntegers(readline()),
		sum = data[0], limit = data[1],
		result = [];
	function lsb(x) {
		var power = 1;
		while (x%2 == 0) {
			x /= 2;
			power *= 2;
		}
		return power;
	}
	for (var i = limit; i >= 1; --i) {
		var bit = lsb(i);
		if (bit <= sum) {
			result.push(i);
			sum -= bit;
			if (sum == 0) {
				break;
			}
		}
	}
	if (sum != 0) {
		print(-1);
	} else {
		print(result.length);
		print(result.join(' '));
	}
}

main();

function reverse(s){
    return s.split("").reverse().join("");
}

function pair(num, lowbit){
	this.num = num
	this.lowbit = lowbit
}

var firstLine = readline().split(" ").map(Number);
var sum = firstLine[0];
var limit = firstLine[1];

var firstDigit = 0

var binaries = []

for(var i = 1; i <= limit; i ++){
	firstDigit = reverse(i.toString(2)).indexOf("1")
	binaries.push(new pair(i, firstDigit))
}

//That is, 2 to the power of lowbit
var numbers = binaries.map(function(a){return new pair(a.num, Math.pow(2, a.lowbit))})

var construct = 0

//Descending order
numbers.sort(function(a,b){return b.lowbit-a.lowbit})

var done = false

var myNums = []

while(!done){
	if(sum === construct){
		done = true
		break
	}
	if(numbers.length === 0){
		break
	}
	next = numbers.shift()
	if(sum - construct < next.lowbit){
		continue
	}
	else{
		myNums.push(next)
		construct += next.lowbit
	}
}

if(done){
	print(myNums.length)
	for(var i = 0; i < myNums.length; i++){
		if(i === myNums.length - 1){
			write(myNums[i].num)
		}
		else{
			write(myNums[i].num + " ")
		}
	}
	// myNums.forEach(function(a){write(a.num+ " ")})
}
else{
	print(-1)
}

function reverse(s){
    return s.split("").reverse().join("");
}

function pair(num, lowbit){
	this.num = num
	this.lowbit = lowbit
}

var firstLine = readline().split(" ").map(Number);
var sum = firstLine[0];
var limit = firstLine[1];

var firstDigit = 0

var binaries = []

for(var i = 1; i <= limit; i ++){
	firstDigit = reverse(i.toString(2)).indexOf("1")
	binaries.push(new pair(i, firstDigit))
}

//That is, 2 to the power of lowbit
var numbers = binaries.map(function(a){return new pair(a.num, Math.pow(2, a.lowbit))})

var construct = 0

//Descending order
numbers.sort(function(a,b){return b.lowbit-a.lowbit})

var done = false

var myNums = []

while(!done){
	if(numbers.length === 0){
		break
	}
	if(sum === construct){
		done = true
		break
	}
	next = numbers.shift()
	if(sum - construct < next.lowbit){
		continue
	}
	else{
		myNums.push(next)
		construct += next.lowbit
	}
}

if(done){
	print(myNums.length)
	for(var i = 0; i < myNums.length; i++){
		if(i === myNums.length - 1){
			write(myNums[i].num)
		}
		else{
			write(myNums[i].num + " ")
		}
	}
	// myNums.forEach(function(a){write(a.num+ " ")})
}
else{
	print(-1)
}


Arkady has a playlist that initially consists of $$$n$$$ songs, numerated from $$$1$$$ to $$$n$$$ in the order they appear in the playlist. Arkady starts listening to the songs in the playlist one by one, starting from song $$$1$$$. The playlist is cycled, i. e. after listening to the last song, Arkady will continue listening from the beginning.Each song has a genre $$$a_i$$$, which is a positive integer. Let Arkady finish listening to a song with genre $$$y$$$, and the genre of the next-to-last listened song be $$$x$$$. If $$$\operatorname{gcd}(x, y) = 1$$$, he deletes the last listened song (with genre $$$y$$$) from the playlist. After that he continues listening normally, skipping the deleted songs, and forgetting about songs he listened to before. In other words, after he deletes a song, he can't delete the next song immediately.Here $$$\operatorname{gcd}(x, y)$$$ denotes the greatest common divisor (GCD) of integers $$$x$$$ and $$$y$$$.For example, if the initial songs' genres were $$$[5, 9, 2, 10, 15]$$$, then the playlist is converted as follows: [5, 9, 2, 10, 15] $$$\to$$$ [5, 9, 2, 10, 15] $$$\to$$$ [5, 2, 10, 15] (because $$$\operatorname{gcd}(5, 9) = 1$$$) $$$\to$$$ [5, 2, 10, 15] $$$\to$$$ [5, 2, 10, 15] $$$\to$$$ [5, 2, 10, 15] $$$\to$$$ [5, 2, 10, 15] $$$\to$$$ [5, 2, 10, 15] $$$\to$$$ [5, 10, 15] (because $$$\operatorname{gcd}(5, 2) = 1$$$) $$$\to$$$ [5, 10, 15] $$$\to$$$ [5, 10, 15] $$$\to$$$ ... The bold numbers represent the two last played songs. Note that after a song is deleted, Arkady forgets that he listened to that and the previous songs.Given the initial playlist, please determine which songs are eventually deleted and the order these songs are deleted.

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10\,000$$$). Description of the test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of songs. The second line contains $$$n$$$ integers $$$a_1, a_2, \ldots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the genres of the songs. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case, print a single line. First, print a single integer $$$k$$$ — the number of deleted songs. After that print $$$k$$$ distinct integers: deleted songs in the order of their deletion.

NoteExplanation of the first test case is given in the statement.In the second test case, the playlist is converted as follows: [1, 2, 4, 2, 4, 2] $$$\to$$$ [1, 2, 4, 2, 4, 2] $$$\to$$$ [1, 4, 2, 4, 2] (because $$$\operatorname{gcd}(1, 2) = 1$$$) $$$\to$$$ [1, 4, 2, 4, 2] $$$\to$$$ [1, 4, 2, 4, 2] $$$\to$$$ [1, 4, 2, 4, 2] $$$\to$$$ [1, 4, 2, 4, 2] $$$\to$$$ [1, 4, 2, 4, 2] $$$\to$$$ [4, 2, 4, 2] (because $$$\operatorname{gcd}(2, 1) = 1$$$) $$$\to$$$ [4, 2, 4, 2] $$$\to$$$ ...In the third test case, the playlist is converted as follows: [1, 2] $$$\to$$$ [1, 2] $$$\to$$$ [1] (because $$$\operatorname{gcd}(1, 2) = 1$$$) $$$\to$$$ [1] $$$\to$$$ [1] (Arkady listened to the same song twice in a row) $$$\to$$$ [] (because $$$\operatorname{gcd}(1, 1) = 1$$$).The fourth test case is same as the third after deletion of the second song.In the fifth test case, the same song is listened to over and over again, but since $$$\operatorname{gcd}(2, 2) \ne 1$$$, it is not deleted.

'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 = 10e3 + 1
var iv = new Array(maxN + 1).fill(0n)
iv[1] = 1n
for (let i = 2n; i <= maxN; i++) {
  iv[i] = mod - (mod / i * iv[mod % i]) % mod
}

function main() {
  var x = parseInt(readline())
  //

  Array(parseInt(x)).fill(1).map((t, iii) => {
    var n = parseInt(readline())
    //   var a = new Array(n)
    //   var marked = new Array(n).fill(false)
    //   var found = new Array(n).fill(false)
    var a = readline().split(' ').map((x, iii) => {
      return parseInt(x)
    });
    var next = new Array(n)
    var q = []
    for (let i = 0; i < n; i++) {
      next[i] = (i + 1) % n

    }
    for (let i = 0; i < n; i++) {
      if (gcd(a[i], a[next[i]]) === 1) q.push(i)
    }
    var used = new Array(n).fill(false)
    var ans = []
    while (q.length !== 0) {
      // console.log(q)
      var pop = q.shift()
      // console.log(q)

      if (!used[pop]) {
        var pair = next[pop]
        ans.push(pair+1)
        if (pair !== pop) {
          used[pair] = true
          next[pop] = next[pair]

          if (gcd(a[pop], a[next[pop]]) === 1) {
            q.push(pop)
          }

        }
      }
    }

    // console.log(q)
    console.log(ans.length, ans.join(' '))
  })
}

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

  return gcd(b, a % b);
}


This problem differs from the next one only in the presence of the constraint on the equal length of all numbers $$$a_1, a_2, \dots, a_n$$$. Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subtask too.A team of SIS students is going to make a trip on a submarine. Their target is an ancient treasure in a sunken ship lying on the bottom of the Great Rybinsk sea. Unfortunately, the students don't know the coordinates of the ship, so they asked Meshanya (who is a hereditary mage) to help them. He agreed to help them, but only if they solve his problem.Let's denote a function that alternates digits of two numbers $$$f(a_1 a_2 \dots a_{p - 1} a_p, b_1 b_2 \dots b_{q - 1} b_q)$$$, where $$$a_1 \dots a_p$$$ and $$$b_1 \dots b_q$$$ are digits of two integers written in the decimal notation without leading zeros.In other words, the function $$$f(x, y)$$$ alternately shuffles the digits of the numbers $$$x$$$ and $$$y$$$ by writing them from the lowest digits to the older ones, starting with the number $$$y$$$. The result of the function is also built from right to left (that is, from the lower digits to the older ones). If the digits of one of the arguments have ended, then the remaining digits of the other argument are written out. Familiarize with examples and formal definitions of the function below.For example: $$$$$$f(1111, 2222) = 12121212$$$$$$ $$$$$$f(7777, 888) = 7787878$$$$$$ $$$$$$f(33, 44444) = 4443434$$$$$$ $$$$$$f(555, 6) = 5556$$$$$$ $$$$$$f(111, 2222) = 2121212$$$$$$Formally,  if $$$p \ge q$$$ then $$$f(a_1 \dots a_p, b_1 \dots b_q) = a_1 a_2 \dots a_{p - q + 1} b_1 a_{p - q + 2} b_2 \dots a_{p - 1} b_{q - 1} a_p b_q$$$;  if $$$p < q$$$ then $$$f(a_1 \dots a_p, b_1 \dots b_q) = b_1 b_2 \dots b_{q - p} a_1 b_{q - p + 1} a_2 \dots a_{p - 1} b_{q - 1} a_p b_q$$$. Mishanya gives you an array consisting of $$$n$$$ integers $$$a_i$$$. All numbers in this array are of equal length (that is, they consist of the same number of digits). Your task is to help students to calculate $$$\sum_{i = 1}^{n}\sum_{j = 1}^{n} f(a_i, a_j)$$$ modulo $$$998\,244\,353$$$.

The first line of the input contains a single integer $$$n$$$ ($$$1 \le n \le 100\,000$$$) — the number of elements in the array. The second line of the input contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array. All numbers $$$a_1, a_2, \dots, a_n$$$ are of equal length (that is, they consist of the same number of digits).

Print the answer modulo $$$998\,244\,353$$$.

var mod = 998244353, count = 10;

var n = +readline();
var arr = readline().split(' ');

var sum = 0;

for(var i = 0; i < n; i++) {
  var val = '';
  for(var j = 0; j < arr[i].length; j++) {
    val += arr[i][j] + arr[i][j];
    if(val.length > 10) {
      val = +val % mod + '';
    }
  }
  sum = (sum + (+val * n)) % mod;
}

print(sum);

const mod = 998244353;

function checkMod(a) {
  return a > mod ? a % mod : a;
}

function func(a1, a2) {
  var res = [];
  for (var i = 0; i < a1.length; i++) {
    res.push(a1[i]);
    res.push(a2[i]);
  }
  return res.join('');
}

var n = +readline();
var arr = readline().split(' ');

var sum = 0;

for(var i = 0; i < arr.length; i++) {
  sum = checkMod(sum + checkMod(checkMod(+func(arr[i], arr[i])) * n));
}

print(sum);

const mod = 998244353;

function checkMod(a) {
  return a > mod ? a % mod : a;
}

function func(a1, a2) {
  var res = [];
  for (var i = 0; i < a1.length; i++) {
    res.push(a1[i]);
    res.push(a2[i]);
  }
  return res.join('');
}

var n = +readline();
var obj = {};
var arr = [];
readline().split(' ').forEach(item => {
  if(obj[item]) {
    obj[item]++;
  } else {
    arr.push(item);
    obj[item] = 1;
  }
});

var sum = 0;

for(var i = 0; i < arr.length; i++) {
  sum += +func(arr[i], arr[i]) * n * obj[arr[i]];
}

print(checkMod(sum));

const mod = 998244353;

function checkMod(a) {
  return a > mod ? a % mod : a;
}

function func(a1, a2) {
  var res = [];
  for (var i = 0; i < a1.length; i++) {
    res.push(a1[i]);
    res.push(a2[i]);
  }
  return res.join('');
}

var n = +readline();
var obj = {};
var arr = readline().split(' ');

var sum = 0;

for(var i = 0; i < arr.length; i++) {
  sum += checkMod(+func(arr[i], arr[i]) * n);
}

print(checkMod(sum));

const mod = 998244353;

function checkMod(a) {
  return a > mod ? a % mod : a;
}

function func(a1, a2) {
  var res = [];
  for (var i = 0; i < a1.length; i++) {
    res.push(a1[i]);
    res.push(a2[i]);
  }
  return res.join('');
}

var n = +readline();
var obj = {};
var arr = readline().split(' ');

var sum = 0;

for(var i = 0; i < arr.length; i++) {
  sum = checkMod(sum + checkMod(parseInt(func(arr[i], arr[i])) * n));
}

print(sum);

const mod = 998244353;

function checkMod(a) {
  return a > mod ? a % mod : a;
}

function func(a1, a2) {
  var res = [];
  for (var i = 0; i < a1.length; i++) {
    res.push(a1[i]);
    res.push(a2[i]);
  }
  return res.join('');
}

var n = +readline();
var obj = {};
var arr = [];
readline().split(' ').forEach(item => {
  if(obj[item]) {
    obj[item]++;
  } else {
    arr.push(item);
    obj[item] = 1;
  }
});

var sum = 0;

for(var i = 0; i < arr.length; i++) {
  sum += +func(arr[i], arr[i]) * (obj[arr[i]] * obj[arr[i]]);
  for(var j = i + 1; j < arr.length; j++) {
    sum += +func(arr[i], arr[j]) * (obj[arr[i]] + obj[arr[j]]);
    sum += +func(arr[j], arr[i]) * (obj[arr[i]] + obj[arr[j]]);
  }
}

const mod = 998244353;

function checkMod(a) {
  return a > mod ? a % mod : a;
}

function func(a1, a2) {
  var res = [];
  for (var i = 0; i < a1.length; i++) {
    res.push(a1[i]);
    res.push(a2[i]);
  }
  return res.join('');
}

var n = +readline();
var obj = {};
var arr = readline().split(' ');

var sum = 0;

for(var i = 0; i < arr.length; i++) {
  sum += +func(arr[i], arr[i]) * n;
}

print(checkMod(sum));