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


// '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;

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

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

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


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

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

// 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" );
            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();

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


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

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


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


function NOD(A)
{
    var n = A.length, x = Math.abs(A[0]);
    for (var i = 1; i < n; i++)
     { var y = Math.abs(A[i]);
       while (x && y){ x > y ? x %= y : y %= x; }
       x += y;
     }
    return x;
}

function main()
{
    // Your code here
    n = Number(readline());
    a = readline().split(' ').map(Number);
    a = a.sort(function(a,b){return a - b});
    d = a[1] - a[0];
    for (var i = 1; i < n-1; i++) {
        s = a[1+i] - a[i];
        d = NOD([d, s]);
    }
    z = Math.round((a[n-1]-a[0]) / d);
    print(z-n+1);
    return 0;
}
main();

var n = readline().split(' ').map(function(v){return v;});
var arr = readline().split(' ').map(function(v){return v;});
arr.sort(function(a, b) {
  return a - b;
});
var g = 0;
var ans = 0;
for (var i = 1; i < n; i++) {
    g = gcd_rec(g, arr[i] - arr[i - 1]);
}
for (var i = 1; i < n; i++) {
    ans += ((arr[i] - arr[i - 1]) / g) - 1;
}
print(ans);

function gcd_rec(a, b) {
    if (b) {
        return gcd_rec(b, a % b);
    } else {
        return Math.abs(a);
    }
}

var n = parseInt(readline())
var x = readline().split(" ").map(v => parseInt(v));

x.sort(function(a,b){return a-b;})

function gcd(x, y){
    return y?gcd(y,x%y):x;
}

var g = 0

for (var i = 1; i < n; ++i)
{
    g = gcd(g, x[i] - x[i-1])
}

var cnt = (x[n-1]-x[0]) / g + 1

print(cnt - n)

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

var n = readline();
var x = readline().split(" ").map(v => +v.trim());
x = x.sort(function(a,b) { return a - b; } );

var nod = gcd(x[1] - x[0], x[2] - x[1]);
for (var i = 3; i < n; ++i) {
    nod = gcd(nod, x[i] - x[i - 1]);
}

var ans = 0;
for (var i = 1; i < n; ++i) {
    ans += (x[i] - x[i - 1]) / nod - 1;
}
print(ans);

function gcd(a, b)
{
  return b ? gcd (b, a % b) : a;
}

var n = readline();
var arr = readline().split(" ").map(v => +v.trim());
arr.sort((a, b) => a - b);
var delta = [];
for (var i = 1; i < n; i++)
  delta.push(arr[i] - arr[i-1]);
var g = gcd(delta[0], delta[1]);
for (var i = 2; i < n-1; i++)
  g = gcd(g, delta[i]);
var ans = 0;
for (var i = 0; i < n - 1; i++)
{
  ans += delta[i] / g - 1;
}
print(ans);

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

var n = parseInt(readline())
var a = readline().split(' ').map(x => parseInt(x))

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

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

var m = 0
for (i = 1; i < n; i += 1) {
  var d = a[i] - a[i - 1]
  m += d / x - 1
}

print(m)

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

function sortNumber(a,b) {
    return a - b;
}

(function main() {
    var n = parseInt(readline());
    var a = readline().split(' ').map(function (x) {
        return parseInt(x);
    }).sort(sortNumber);
    var d = a[1] - a[0];
    for (i = 1; i < a.length - 1; i++) {
        d = gcd(d, a[i + 1] - a[i]);
    }
    var ans = (a[a.length - 1] - a[0]) / d - n + 1;
    print(ans);
})()

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

x.sort(function(a, b) {
  return a - b;
});

var distances = [];

for (i = 0; i < n - 1; i++) {
  distances.push(x[i+1] - x[i]);
}

var nd = NOD(distances);
var cnt = 0;

for (var i = 0; i < n - 1; i++) {
  cnt += (distances[i]/nd)-1;
}

function NOD(A) {
  var n = A.length, x = Math.abs(A[0]);
  for (var i = 1; i < n; i++) {
    var y = Math.abs(A[i]);
    while (x && y){ x > y ? x %= y : y %= x; }
    x += y;
  }
  return x;
}

print(cnt);

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

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

n = parseInt(readline());
a = (readline().split(' '));
for (var i = 0; i < a.length; i++) {
    a[i] = parseInt(a[i]);
}
a.sort((a, b) => a - b);
rcd = a[1] - a[0];
for (var i = 2; i < a.length; i++) {
    rcd = gcd(rcd, a[i] - a[i-1]);
}

sc = 0;
for (var i = 1; i < a.length; i++)
    sc += (a[i] - a[i-1]) / rcd - 1;

print(sc);

var n = parseInt(readline());
var s = readline().split(" ");
var a = [];
function compare(a, b) {
    return a - b;
}
for(var i = 0; i < n; i++) {
    a.push(parseInt(s[i]));
}
a.sort(compare);

function gcd(a, b) {
    while(a > 0 && b > 0) {
        if(a > b) a %= b;
        else b %= a;
    }
    return a + b;
}
var ans = a[1] - a[0];
for(var i = 2; i < n; i++) {
    ans = gcd(ans, a[i] - a[i - 1]);
}
print((a[n - 1] - a[0]) / ans - n + 1);

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

xs.sort(function (a,b) { return a-b; });

function gcd(a, b) {
    var c = 0;
    while (b !== 0) {
        c = a % b;
        a = b;
        b = c;
    }
    return a;
}

var totalGCD = xs[1] - xs[0];

for (var i = 1; i < n; i++) {
    totalGCD = gcd(totalGCD, xs[i] - xs[i-1]);
}

var ans = 0;
for (i = 1; i < n; i++) {
    ans += Math.floor((xs[i] - xs[i-1] - 1) / totalGCD);
}

print(ans);

function gcd(a,b)
{
    if (b)
        return gcd(b,a%b);
    return a;
}
var n=readline().split(" ").map(x=>parseInt(x))[0];
var numbers=readline().split(" ").map(x=>parseInt(x));
numbers.sort(function(a,b){return a-b});
var ans=numbers[1]-numbers[0];
for (i=1;i<n;i++)
    ans=gcd(ans,numbers[i]-numbers[i-1]);
print((numbers[n-1]-numbers[0])/ans+1-n);

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

(function main() {
    var n = parseInt(readline());
    var a = readline().split(' ').map(function (x) {
        return parseInt(x);
    }).sort();
    var d = a[1] - a[0];
    for (i = 1; i < a.length - 1; i++) {
        d = gcd(d, a[i + 1] - a[i]);
    }
    var ans = (a[a.length - 1] - a[0]) / d - n;
    print(ans);
})()

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

(function main() {
    var n = parseInt(readline());
    var a = readline().split(' ').map(function (x) {
        return parseInt(x);
    }).sort();
    var d = a[1] - a[0];
    for (i = 1; i < a.length - 1; i++) {
        d = gcd(d, a[i + 1] - a[i]);
    }
    var ans = (a[a.length - 1] - a[0]) / d - n + 1;
    print(ans);
})()

var n = 0 + 1 * readline();
var s = readline().split(" ");
var a = [];
function compare(a, b) {
    return a > b;
}
for(var i = 0; i < n; i++) {
    a.push(parseInt(s[i]));
}
a.sort(compare);

function gcd(a, b) {
    while((a > 0) && (b > 0)) {
        if(a > b) a %= b;
        else b %= a;
    }
    return a + b;
}
var ans = a[1] - a[0];
for(var i = 1; i < n; i++) {
    ans = gcd(ans, a[i] - a[i - 1]);
}
print((a[n - 1] - a[0]) / ans - n + 1);

var n = readline();
var arr = readline().split(" ").map(function(v){return +v;});
arr.sort();
var g = 0;
var ans = 0;
for (var i = 1; i < n; i++) {
    g = gcd_rec(g, arr[i] - arr[i - 1]);
}
for (var i = 1; i < n; i++) {
    ans += (arr[i] - arr[i - 1]) / g - 1;
}
print(ans);

function gcd_rec(a, b) {
    if (b) {
        return gcd_rec(b, a % b);
    } else {
        return Math.abs(a);
    }
}

var n = parseInt(readline())
var x = readline().split(" ").map(v => parseInt(v));

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

function gcd(x, y){
    return y?gcd(y,x%y):x;
}

var g = 0

for (var i = 1; i < n; ++i)
{
    g = gcd(g, x[i] - x[i-1])
}

var cnt = (x[n-1]-x[0]) / g + 1

print(cnt - n)

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

x.sort(function(a, b) {
  return a - b;
});

var padding;

var m = 0;

if (x[1] - x[0] < x[x.length-1] - x[x.length-2]) {
  padding = x[1] - x[0];
} else {
  padding = x[x.length-1] - x[x.length-2];
}

for (i = 1; i < x.length; i++) {
  var currentPadding = x[i] - x[i-1];
  if (currentPadding !== padding) {
    m = currentPadding / padding - 1;
    break;
  }
}

print(m);


var line = readline().split(' ');

var n = parseInt(line[0]);
var t = parseInt(line[1]);
var c = parseFloat(line[2]);

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

var m = parseInt(readline());

var p = readline().split(' ');

var mean = [0.0];

var real = [];
real[t-1] = 0;
for(var j = 0; j < t; j++){
    real[t-1] += a[j]/t;
}

for(var i=0; i<n; i++){
    mean[i + 1] = (mean[i] + parseInt(a[i])/t) / c;
    real[t + i] = real[t + i - 1] + (a[t + i] - a[i])/t;
}

for(var i = 0; i < m; i++){
    //console.log((real[parseInt(p[i]) - 1]).toFixed(5));
    print((real[parseInt(p[i]) - 1]).toFixed(6) + ' ' + (mean[parseInt(p[i])]).toFixed(6) + ' ' + error((real[parseInt(p[i]) - 1]).toFixed(6),(mean[parseInt(p[i])]).toFixed(6)));
}

function error(real , mean) {
    return (Math.abs(mean - real)/real).toFixed(6);
}

var line = readline().split(' ').map((v) => { return Number(v); }),
	n = line[0],
	T = line[1],
	c = line[2];

var a = readline().split(' ').map((v) => { return Number(v); });

var m = Number(readline());

var p = readline().split(' ').map((v) => { return Number(v); });

var sum = 0;
var aSum = 0;
var pCounter = 0;
var approx = 0;
for (var i = 0; i < n; i++) {
	sum += a[i];
	aSum += a[i];
	if (a[i - T]) {
		aSum = aSum - a[i - T];
	}
	var real = aSum/T;
	approx = (approx + a[i]/T)/c;
	if (i + 1 === p[pCounter]) {
		real = aSum/T;
		var error = Math.abs(approx - real)/real;
		print(real.toFixed(6) + ' ' + approx.toFixed(6) + ' ' + error.toFixed(6));
		if (pCounter < m) {
			pCounter++;
		} else {
			break;
		}
	}
}

var init = readline().split(' '),
    n = +init[0],
    T = +init[1],
    c = +init[2],
    a = readline().split(' '),
    m = +readline(),
    p = readline().split(' '),
    real,
    approx = 0,
    error,
    i = 0,
    j = 0,
    l = 0,
    d,
    mean = 0;
for (; i < n && j < m; i++) {
    d = a[i]/T;
    approx = (approx + d)/c;
    mean += d;
    i >= T && (mean -= a[i - T]/T);
    if (i === p[j] - 1) {
        j++;
        real = i + 1 < T ? mean * T / (i + 1) : mean;
        error = Math.abs(approx-real)/real;
        print(real.toFixed(5) + ' '
            + approx.toFixed(5) + ' '
            + error.toFixed(5));
    }
}


var i, input, buffer = [], blockWidth = 0, frameChar = '*', xlPad = false;

function formatText(text, left){
    var lPad = '', rPad;
    if ((blockWidth - text.length) % 2) {
        if (xlPad) lPad = ' ';
        xlPad = !xlPad;
    }
    lPad += ' '.repeat(Math.floor((blockWidth - text.length)/2));
    rPad = ' '.repeat(blockWidth - text.length - lPad.length);
    return frameChar + lPad + text + rPad + frameChar;
}

while (true){
    input = readline();
    if (typeof input === 'undefined') break;

    if (input.length > blockWidth) blockWidth = input.length;
    buffer.push(input);
}

print(frameChar.repeat(blockWidth + 2));

for (i=0; i<buffer.length; i++){
    print(formatText(buffer[i]));
}

print(frameChar.repeat(blockWidth + 2));

// Generated by CoffeeScript 1.4.0
(function() {
  var chars, hr, incl, line, lines, lpad, maxLen, pad, padstr, rlpad, rpad, _i, _len;

  lines = [];

  maxLen = 0;

  chars = function(n, c) {
    return new Array(n + 1).join(c);
  };

  while (typeof (line = readline()) === 'string') {
    lines.push(line);
    maxLen = Math.max(line.length, maxLen);
  }

  hr = chars(maxLen + 2, '*');

  incl = false;

  print(hr);

  for (_i = 0, _len = lines.length; _i < _len; _i++) {
    line = lines[_i];
    rlpad = maxLen - line.length;
    pad = Math.floor(rlpad / 2);
    padstr = chars(pad, ' ');
    if (rlpad % 2) {
      lpad = pad;
      rpad = pad;
      if (incl) {
        print('*' + padstr + ' ' + line + padstr + '*');
        incl = false;
      } else {
        print('*' + padstr + line + padstr + ' ' + '*');
        incl = true;
      }
    } else {
      print('*' + padstr + line + padstr + '*');
    }
  }

  print(hr);

}).call(this);

'use strict';

/*let input = `
welcome to the
Codeforces
Beta
Round 5

and
good luck
`.trim().split('\n');
function print(output) {
	console.log(output);
}
function readline() {
	return input.shift();
}*/

//code

var lines = [],
    line = void 0,
    width = 0;
while ((line = readline()) !== undefined) {
	lines.push(line);
	if (line.length > width) {
		width = line.length;
	}
}
var stars = [],
    output = [],
    left = true;
for (var i = 0; i < width + 2; i++) {
	stars.push('*');
}
output.push(stars.join(''));
lines = lines.map(function (el) {
	var diff = width - el.length;
	var spaces = [];
	for (var i = 0; i < Math.floor(diff / 2); i++) {
		spaces.push(' ');
	}
	if (diff % 2 === 0) {
		output.push("*" + spaces.concat(el.split('').concat(spaces)).join('') + "*");
	} else {
		var result = [];
		if (left) {
			result = result.concat(spaces);
			result = result.concat(el.split(''));
			result = result.concat(spaces.concat([' ']));
		} else {
			result = result.concat(spaces.concat([' ']));
			result = result.concat(el.split(''));
			result = result.concat(spaces);
		}
		left = !left;
		output.push("*" + result.join('') + "*");
	}
});
output.push(stars.join(''));
print(output.join('\n'));

var text = [];
var maxL = -Infinity;

try {
    while (true) {
        str = readline();
        maxL = Math.max(maxL, str.length);
        text.push(str);
    }
}
catch(e){

}

for (var i = -1; i <= maxL; i++) write('*')
write('\n');
var offset = 0;
for (var i = 0; i < text.length; i++) {

    write('*');
    var flag = (maxL - text[i].length) % 2;
    if (flag == 1) {
        var space = (maxL - text[i].length + offset) >> 1;
        offset = 1 - offset;
    } else {
        var space = (maxL - text[i].length) >> 1;
    }
    for (var j = 0; j < space; j++) write(' ');
    write(text[i]);
    for (var j = 0; j < maxL - space - text[i].length; j++) write(' ');
    write('*');
    write('\n');
}
for (var i = -1; i <= maxL; i++) write('*');

var line;
var max=0;
var lines=[];
while( (line = readline() )!== undefined){
	if(line.length>max){
		max = line.length;
	}
	lines.push(line);
}

print( p('*', max+2) );

var f = true;
for(var i=0; i<lines.length; i++){
	if( (max-lines[i].length)%2==0 ){
		var j= (max-lines[i].length) / 2;
	}else{
		if(f){
			var j=Math.floor( (max-lines[i].length) / 2 );
			f=!f;
		}else{
			var j=Math.ceil( (max-lines[i].length) / 2 );
			f=!f;
		}
	}

	var be = p(' ', j);
	var af = p(' ', max-lines[i].length-j);
	print( '*' + be + lines[i] + af + '*');
}

print( p('*', max+2) );

function p(s, n){
	var a = [];
	while(n--){
		a.push(s);
	}
	return a.join('');
}

var ss = []
var w = 0

var lo = false
var l

while (true) {
  l = readline()
  if (typeof l != 'string') break
  ss.push(l)
  if (l.length > w) w = l.length
}

var out = []
var sts = ''
for (var i = 0; i < w + 2; i++) {
  sts += '*'
}

out.push(sts)

for (var i = 0; i < ss.length; i++) {
  out.push('*' + cent(ss[i]) + '*')
}

out.push(sts)

print(out.join('\n'))

function cent (s) {
  var pl, pr
  if ((w - s.length) % 2 | 0) {
    lo = !lo
  }
  if (lo) {
    pl = Math.floor((w - s.length) / 2)
    pr = Math.ceil((w - s.length) / 2)
  } else {
    pr = Math.floor((w - s.length) / 2)
    pl = Math.ceil((w - s.length) / 2)
  }
  var ns = ''
  for (var i = 0; i < pl; i++) {
    ns += ' '
  }
  ns += s
  for (var i = 0; i < pr; i++) {
    ns += ' '
  }
  return ns
}

var i, input, buffer = [], blockWidth = 0, frameChar = '*';

function formatText(text){
    var lPad, rPad;
    lPad = ' '.repeat(Math.floor((blockWidth - text.length)/2));
    rPad = ' '.repeat(blockWidth - text.length - lPad.length);
    return frameChar + lPad + text + rPad + frameChar;
}

while (true){
    input = readline();
    if (typeof input === 'undefined') break;

    if (input.length > blockWidth) blockWidth = input.length;
    buffer.push(input);
}

print(frameChar.repeat(blockWidth + 2));

for (i=0; i<buffer.length; i++){
    print(formatText(buffer[i]));
}

print(frameChar.repeat(blockWidth + 2));

var line;
var max=0;
var lines=[];
while( (line = readline() )!== undefined){
	if(line.length>max){
		max = line.length;
	}
	lines.push(line);
}

print( p('*', max+2) );

for(var i=0; i<lines.length; i++){
	var j=Math.floor( (max-lines[i].length) /2 );
	if( j&&lines[i].length<4){
	 	j=j+1;
	}
	var be = p(' ', j);
	var af = p(' ', max-lines[i].length-j);
	print( '*' + be + lines[i] + af + '*');
}

print( p('*', max+2) );

function p(s, n){
	var a = [];
	while(n--){
		a.push(s);
	}
	return a.join('');
}

var line;
var max=0;
var lines=[];
while( (line = readline() )!== undefined){
	if(line.length>max){
		max = line.length;
	}
	lines.push(line);
}

print( p('*', max+2) );

for(var i=0; i<lines.length; i++){
	var be = p(' ', Math.ceil( (max-lines[i].length) /2 ));
	var af = p(' ', Math.floor( (max-lines[i].length) /2 ));
	print( '*' + be + lines[i] + af + '*');
}

print( p('*', max+2) );

function p(s, n){
	var a = [];
	while(n--){
		a.push(s);
	}
	return a.join('');
}

var line;
var max=0;
var lines=[];
while(line = readline()){
	if(line.length>max){
		max = line.length;
	}
	lines.push(line);
}

print( p('*', max+2) );

for(var i=0; i<lines.length; i++){
	var be = p(' ', Math.ceil( (max-lines[i].length) /2 ));
	var af = p(' ', Math.floor( (max-lines[i].length) /2 ));
	print( '*' + be + lines[i] + af + '*');
}

print( p('*', max+2) );

function p(s, n){
	var a = [];
	while(n--){
		a.push(s);
	}
	return a.join('');
}