You have a blackboard and initially only an odd number $$$x$$$ is written on it. Your goal is to write the number $$$1$$$ on the blackboard.You may write new numbers on the blackboard with the following two operations.   You may take two numbers (not necessarily distinct) already on the blackboard and write their sum on the blackboard. The two numbers you have chosen remain on the blackboard.  You may take two numbers (not necessarily distinct) already on the blackboard and write their bitwise XOR on the blackboard. The two numbers you have chosen remain on the blackboard.  Perform a sequence of operations such that at the end the number $$$1$$$ is on the blackboard.

The single line of the input contains the odd integer $$$x$$$ ($$$3 \le x \le 999,999$$$).

Print on the first line the number $$$q$$$ of operations you perform. Then $$$q$$$ lines should follow, each describing one operation.    The "sum" operation is described by the line "$$$a$$$ + $$$b$$$", where $$$a, b$$$ must be integers already present on the blackboard.  The "xor" operation is described by the line "$$$a$$$ ^ $$$b$$$", where $$$a, b$$$ must be integers already present on the blackboard.  The operation symbol (+ or ^) must be separated from $$$a, b$$$ by a whitespace. You can perform at most $$$100,000$$$ operations (that is, $$$q\le 100,000$$$) and all numbers written on the blackboard must be in the range $$$[0, 5\cdot10^{18}]$$$. It can be proven that under such restrictions the required sequence of operations exists. You can output any suitable sequence of operations.

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i - a] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0;

  let xor = (a, b) => {
    return ((a / 65536 | 0) ^ (b / 65536 | 0)) * 65536 + ((a % 65536) ^ (b % 65536))
  }

  let x = $()
  if (x & 2) {
    out.push(`${x} + ${x}`);
    out.push(`${x} ^ ${x + x}`);
    x = xor(x, x + x);
  }
  let x2 = x
  For(log2(x) | 0, i => {
    out.push(`${x2} + ${x2}`); x2 = x2 + x2;
  });
  out.push(`${x} + ${x2}`);
  out.push(`${x} ^ ${x2}`);
  out.push(`${x + x2} ^ ${xor(x, x2)}`);
  x2 = 1 << (1 + log2(x) | 0)

  while (1) {
    // log(x.toString(2));
    // log(x2.toString(2));
    // log('---')
    if (x < x2) {
      let a = x;
      while (log2(a) != (log2(a) | 0)) {
        out.push(`${a} + ${a}`); a = a + a;
        if (a > x2) {
          out.push(`${a} ^ ${x2}`); a = xor(a, x2);
        }
      }
      x2 = a;
      if (x2 == 1) break;
    } else {
      let a = x, b = x2;
      while (b < a) {
        if (a & b) {
          out.push(`${a} ^ ${b}`); a = xor(a, b);
        }
        if (a == 1) break;
        out.push(`${b} + ${b}`); b = b + b;
      }
      x = a;
      if (x == 1) break;
    }
  }
  log(out.length)
  log(out.join('\n'))
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0
  let a = [$()], m = { [a[0]]: 1 }

  For(1e4, _ => {
    let i = rand(a.length), j = rand(a.length);
    let x;
    x = a[i] + a[j];
    if (x < 1e8 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[j]}`)
    }
    x = a[i] + a[i];
    if (x < 1e8 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[i]}`)
    }
    x = a[j] + a[j];
    if (x < 1e8 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[j]} + ${a[j]}`)
    }
    x = a[i] ^ a[j];
    if (x > 0 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} ^ ${a[j]}`)
    }
  })

  let xor = (a, b) => {
    return ((a / 65536 | 0) ^ (b / 65536 | 0)) * 65536 + ((a % 65536) ^ (b % 65536))
  }
  let solve = x => {
    let x1, x2, x3, x4, x5, p2;
    if (x == (2 ** ceil(log2(x))) - 1) {
      x1 = x + x; out.push(`${x} + ${x}`)
      x2 = xor(x, x1); out.push(`${x} ^ ${x1}`)
      x3 = x + x2; out.push(`${x} + ${x2}`)
      x4 = x1 + x3; out.push(`${x1} + ${x3}`)
      x5 = x1 + x1; out.push(`${x1} + ${x1}`)
      p2 = 2; out.push(`${x4} ^ ${x5}`) // 2
      while (p2 + 1 < x2) {
        out.push(`${p2} + ${p2}`); p2 = p2 + p2;
      }
      out.push(`${p2} ^ ${x2}`) // 1
      return true;
    }
    if (x == (2 ** floor(log2(x))) + 1) {
      x2 = x; x3 = x;
      For(floor(log2(x)) - 1, i => {
        out.push(`${x2} + ${x2}`); x2 = x2 + x2;
        out.push(`${x3} + ${x2}`); x3 = x3 + x2;
      });
      return solve(x3);
    }
  }
  // out = []
  // solve(524289)
  // log(out.join('\n'))
  // return;

  a.sort(asc)
  // log(a.length)
  let id = a.findIndex((_, i) => i > 0 && (a[i] ^ a[i - 1]) == 1);
  if (id > 0) {
    out.push(`${a[id]} ^ ${a[id - 1]}`)
    log(out.length);
    log(out.join('\n'))
  } else {
    a.forEach(v => {
      if (solve(v)) {
        log(out.length);
        log(out.join('\n'))
        process.exit()
      }
    })
  }
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0
  let a = [$()], m = { [a[0]]: 1 }

  For(1e5, _ => {
    if (a.length > 8e4) return 0;
    let i = rand(a.length), j = rand(a.length);
    let x;
    x = a[i] + a[j];
    if (x < 1e8 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[j]}`)
    }
    x = a[i] + a[i];
    if (x < 1e8 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[i]}`)
    }
    x = a[j] + a[j];
    if (x < 1e8 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[j]} + ${a[j]}`)
    }
    x = a[i] ^ a[j];
    if (x > 0 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} ^ ${a[j]}`)
    }
  })

  let xor = (a, b) => {
    return ((a / 65536 | 0) ^ (b / 65536 | 0)) * 65536 + ((a % 65536) ^ (b % 65536))
  }
  let solve = x => {
    let x1, x2, x3, x4, x5, p2;
    if (x == (2 ** ceil(log2(x))) - 1) {
      x1 = x + x; out.push(`${x} + ${x}`)
      x2 = xor(x, x1); out.push(`${x} ^ ${x1}`)
      x3 = x + x2; out.push(`${x} + ${x2}`)
      x4 = x1 + x3; out.push(`${x1} + ${x3}`)
      x5 = x1 + x1; out.push(`${x1} + ${x1}`)
      p2 = 2; out.push(`${x4} ^ ${x5}`) // 2
      while (p2 + 1 < x2) {
        out.push(`${p2} + ${p2}`); p2 = p2 + p2;
      }
      out.push(`${p2} ^ ${x2}`) // 1
      return true;
    }
    if (x == (2 ** floor(log2(x))) + 1) {
      x2 = x; x3 = x;
      For(floor(log2(x)) - 1, i => {
        out.push(`${x2} + ${x2}`); x2 = x2 + x2;
        out.push(`${x3} + ${x2}`); x3 = x3 + x2;
      });
      return solve(x3);
    }
  }
  // out = []
  // solve(524289)
  // log(out.join('\n'))
  // return;

  a.sort(asc)
  // log(a.length)
  let id = a.findIndex((_, i) => i > 0 && (a[i] ^ a[i - 1]) == 1);
  if (id > 0) {
    out.push(`${a[id]} ^ ${a[id - 1]}`)
    log(out.length);
    log(out.join('\n'))
  } else {
    a.forEach(v => {
      if (solve(v)) {
        log(out.length);
        log(out.join('\n'))
        process.exit()
      }
    })
  }
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0
  let a = [$()], m = { [a[0]]: 1 }

  For(1e4, _ => {
    let i = rand(a.length), j = rand(a.length);
    let x = a[i] + a[j];
    if (x < 1e7 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[j]}`)
    }
    x = a[i] ^ a[j];
    if (x > 0 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} ^ ${a[j]}`)
    }
  })

  let solve = x => {
    let x1, x2, x3, x4, x5, p2;
    return For(2, 24, i => {
      if (x == (1 << i) - 1) {
        x1 = x + x; out.push(`${x} + ${x}`)
        x2 = x ^ x1; out.push(`${x} ^ ${x1}`)
        x3 = x + x2; out.push(`${x} + ${x2}`)
        x4 = x1 + x3; out.push(`${x1} + ${x3}`)
        x5 = x1 + x1; out.push(`${x1} + ${x1}`)
        p2 = 2; out.push(`${x4} ^ ${x5}`) // 2
        while (p2 + 1 < x2) {
          out.push(`${p2} + ${p2}`); p2 = p2 + p2;
        }
        out.push(`${p2} ^ ${x2}`) // 1
        return true;
      }
    })
  }

  a.sort(asc)
  // log(a)
  let id = a.findIndex((_, i) => i > 0 && (a[i] ^ a[i - 1]) == 1);
  if (id > 0) {
    out.push(`${a[id]} ^ ${a[id - 1]}`)
    log(out.length);
    log(out.join('\n'))
  } else {
    a.forEach(v => {
      if (solve(v)) {
        log(out.length);
        log(out.join('\n'))
        process.exit()
      }
    })
  }
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0
  let a = [$()], m = { [a[0]]: 1 }

  For(1e4, _ => {
    let i = rand(a.length), j = rand(a.length);
    let x = a[i] + a[j];
    if (x < 1e7 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[j]}`)
    }
    x = a[i] ^ a[j];
    if (x > 0 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} ^ ${a[j]}`)
    }
  })

  a.sort(asc)
  // log(a)
  let id = a.findIndex((_, i) => i > 0 && (a[i] ^ a[i - 1]) == 1);
  if (id > 0) {
    out.push(`${a[id]} ^ ${a[id - 1]}`)
    log(out.length);
    log(out.join('\n'))
  }
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i - a] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0;
  let x = $()
  if (x & 2) {
    out.push(`${x} + ${x}`);
    out.push(`${x} ^ ${x + x}`);
    x = x ^ (x + x);
  }
  let x2 = x
  For(log2(x) | 0, i => {
    out.push(`${x2} + ${x2}`); x2 = x2 + x2;
  });
  out.push(`${x} + ${x2}`);
  out.push(`${x} ^ ${x2}`);
  out.push(`${x + x2} ^ ${x ^ x2}`);
  x2 = 1 << (1 + log2(x) | 0)

  while (1) {
    // log(x.toString(2));
    // log(x2.toString(2));
    // log('---')
    if (x < x2) {
      let a = x;
      while (log2(a) != (log2(a) | 0)) {
        out.push(`${a} + ${a}`); a = a + a;
        if (a > x2) {
          out.push(`${a} ^ ${x}`); a = a ^ x2;
        }
      }
      x2 = a;
      if (x2 == 1) break;
    } else {
      let a = x, b = x2;
      while (b < a) {
        if (a & b) {
          out.push(`${a} ^ ${b}`); a = a ^ b;
        }
        if (a == 1) break;
        out.push(`${b} + ${b}`); b = b + b;
      }
      x = a;
      if (x == 1) break;
    }
  }
  log(out.length)
  log(out.join('\n'))
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i - a] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0;
  let x = $()
  if (x & 2) {
    out.push(`${x} + ${x}`);
    out.push(`${x} ^ ${x + x}`);
    x = x ^ (x + x);
  }
  let x2 = x
  For(log2(x) | 0, i => {
    out.push(`${x2} + ${x2}`); x2 = x2 + x2;
  });
  out.push(`${x} + ${x2}`);
  out.push(`${x} ^ ${x2}`);
  out.push(`${x + x2} ^ ${x ^ x2}`);
  x2 = 1 << (1 + log2(x) | 0)

  while (1) {
    // log(x.toString(2));
    // log(x2.toString(2));
    // log('---')
    if (x < x2) {
      let a = x;
      while (log2(a) != (log2(a) | 0)) {
        out.push(`${a} + ${a}`); a = a + a;
        if (a > x2) {
          out.push(`${a} ^ ${x2}`); a = a ^ x2;
        }
      }
      x2 = a;
      if (x2 == 1) break;
    } else {
      let a = x, b = x2;
      while (b < a) {
        if (a & b) {
          out.push(`${a} ^ ${b}`); a = a ^ b;
        }
        if (a == 1) break;
        out.push(`${b} + ${b}`); b = b + b;
      }
      x = a;
      if (x == 1) break;
    }
  }
  log(out.length)
  log(out.join('\n'))
}

function For(a, b, fn) {
  if (!fn) return For(0, a - 1, b);
  let res;
  for (let i = a; i <= b; i++) {
    if ((res = fn(i)) != null) return res;
  }
}
function ForR(a, b, fn) {
  if (!fn) return ForR(a - 1, 0, b);
  let res;
  for (let i = a; i >= b; i--) {
    if ((res = fn(i)) != null) return res;
  }
}

function Arr(a, b, fn) {
  if (typeof (b) == 'function') return Arr(0, a - 1, b);
  if (b < a) return [];
  let arr = Array(b - a + 1)
  for (let i = a; i <= b; i++) arr[i] = fn(i, arr);
  return arr;
}

Object.defineProperty(Object.prototype, '$k', {
  value: function () { return Object.keys(this) }
});
Object.defineProperty(Object.prototype, '$v', {
  value: function () { return Object.values(this) }
});
Object.defineProperty(Object.prototype, '$kv', {
  value: function () { return Object.entries(this) }
});
Array.prototype.sum = function (fn) { return this.reduce((p, v) => p + (fn ? fn(v) : v), 0) }
Array.prototype.uniq = function (fn) {
  var set = new Set();
  return this.filter(v => {
    var newValue = !set.has(fn ? fn(v) : v);
    set.add(fn ? fn(v) : v);
    return newValue;
  });
}
Array.prototype.toObj = function (fn) {
  return this.map(v => fn ? fn(v) : v).reduce((p, v) => {
    p[v[0]] = v[1];
    return p;
  }, {})
}
Array.prototype.min = function (fn) {
  let min = 1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x < min) { min = x; index = i }
  }
  return [this[index], index, min];
}
Array.prototype.max = function (fn) {
  let max = -1e20, index = -1, x;
  for (let i = 0; i < this.length; i++) {
    x = fn ? fn(this[i], i, this) : this[i];
    if (x > max) { max = x; index = i }
  }
  return [this[index], index, max];
}
Array.prototype.rev = function (first, last) {
  for (let i = first; i < (first + last) / 2; i++) {
    [this[i], this[last - 1 - i + first]] = [this[last - 1 - i + first], this[i]]
  }
}
Array.prototype.set = function (pos, arr) {
  for (let i = pos; i < pos + arr.length; i++) {
    this[i] = arr[i - pos];
  }
}
Array.prototype.for = function (a, b, fn) {
  let res
  for (let i = a; i <= b; i++) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.forR = function (a, b, fn) {
  let res
  for (let i = a; i >= b; i--) {
    if ((res = fn(this[i], i, this)) != null) return res;
  }
}
Array.prototype.bin = function (comp, a, b) {
  let mid;
  while (a < b) {
    mid = (a + b) / 2 | 0;
    if (typeof comp == 'function' ? comp(this[mid]) : this[mid] < comp) a = mid + 1;
    else b = mid;
  }
  return a;
}
Array.prototype.cut = function (fn, a, b) {
  let arr = [];
  a = a || 0;
  b = b || (this.length - 1);
  let prev = a;
  for (let i = a; i <= b; i++) {
    if (i == b || fn(this[i], this[i + 1])) {
      arr.push(this.slice(prev, i + 1));
      prev = i + 1;
    }
  }
  return arr;
}

function gcd(a, b) {
  while (b) [a, b] = [b, a % b];
  return a;
}
function mul(a, b, m) {
  return ((a >> 16) * b % m * 65536 + (a & 65535) * b) % m
}
function pow(a, n, m) {
  let r = 1;
  while (n) n & 1 ? (r = mul(r, a, m), n--) : [a, n] = [mul(a, a, m), n >> 1]
  return r;
}
function inv(b, m) {
  for (var a = m, 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);
  return (u + m) % m;
}

// let MOD = 1e9 + 7
// let gt = Arr(n, (i, a) => i == 0 ? 1 : mul(a[i - 1], i, MOD));
// let rgt = Arr(n, (i, a) => i <= 1 ? 1 : MOD - mul((MOD / i | 0), a[MOD % i], MOD));
// For(2, n - 1, i => { rgt[i] = mul(rgt[i], rgt[i - 1], MOD) });
// let nCk = (n, k) => mul(mul(gt[n], rgt[k], MOD), rgt[n - k], MOD);

// for (i = pos; i <= n; i += i & -i) fen[i]++; // start from index 1
// for (i = pos; i; i -= i & -i) ans += fen[i];

// let p = [2];
// for (let i = 3; i < 1e5; i += 2) {
//   let j, x = Math.sqrt(i);
//   for (j = 0; p[j] <= x; j++) if (i % p[j] == 0) break;
//   if (i % p[j] != 0) p.push(i);
// }

// let root = x => par[x] < 0 ? x : (par[x] = root(par[x]));
// let dsu = (x, y) => {
//   if ((x = root(x)) == (y = root(y))) return;
//   if (par[y] < par[x]) [x, y] = [y, x];
//   par[x] += par[y];
//   par[y] = x;
// }

let input = '';
process.stdin.on('data', c => input += c);
process.stdin.on('end', main);
async function main() {
  let inp = input.split(/\s+/).map(v => +v), _i = 0, $ = n => n != null ? inp.slice(_i, _i += n) : inp[_i++],
    out = [], log = console.log, asc = (a, b) => a - b, desc = (a, b) => b - a, { min, max, ceil, floor, sqrt, abs, log2 } = Math,
    bi = BigInt, rand = n => Math.random() * n | 0
  let a = [$()], m = { [a[0]]: 1 }

  For(3e4, _ => {
    let i = rand(a.length), j = rand(a.length);
    let x = a[i] + a[j];
    if (x < 1e7 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} + ${a[j]}`)
    }
    x = a[i] ^ a[j];
    if (x > 0 && !m[x]) {
      a.push(x);
      m[x] = 1;
      out.push(`${a[i]} ^ ${a[j]}`)
    }
  })

  let solve = x => {
    let x1, x2, x3, x4, x5, p2;
    return For(2, 24, i => {
      if (x == (1 << i) - 1) {
        x1 = x + x; out.push(`${x} + ${x}`)
        x2 = x ^ x1; out.push(`${x} ^ ${x1}`)
        x3 = x + x2; out.push(`${x} + ${x2}`)
        x4 = x1 + x3; out.push(`${x1} + ${x3}`)
        x5 = x1 + x1; out.push(`${x1} + ${x1}`)
        p2 = 2; out.push(`${x4} ^ ${x5}`) // 2
        while (p2 + 1 < x2) {
          out.push(`${p2} + ${p2}`); p2 = p2 + p2;
        }
        out.push(`${p2} ^ ${x2}`) // 1
        return true;
      }
    })
  }

  a.sort(asc)
  // log(a)
  let id = a.findIndex((_, i) => i > 0 && (a[i] ^ a[i - 1]) == 1);
  if (id > 0) {
    out.push(`${a[id]} ^ ${a[id - 1]}`)
    log(out.length);
    log(out.join('\n'))
  } else {
    a.forEach(v => {
      if (solve(v)) {
        log(out.length);
        log(out.join('\n'))
        process.exit()
      }
    })
  }
}


A country has n cities. Initially, there is no road in the country. One day, the king decides to construct some roads connecting pairs of cities. Roads can be traversed either way. He wants those roads to be constructed in such a way that it is possible to go from each city to any other city by traversing at most two roads. You are also given m pairs of cities — roads cannot be constructed between these pairs of cities.Your task is to construct the minimum number of roads that still satisfy the above conditions. The constraints will guarantee that this is always possible.

The first line consists of two integers n and m . Then m lines follow, each consisting of two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi), which means that it is not possible to construct a road connecting cities ai and bi. Consider the cities are numbered from 1 to n. It is guaranteed that every pair of cities will appear at most once in the input.

You should print an integer s: the minimum number of roads that should be constructed, in the first line. Then s lines should follow, each consisting of two integers ai and bi (1 ≤ ai, bi ≤ n, ai ≠ bi), which means that a road should be constructed between cities ai and bi. If there are several solutions, you may print any of them.

NoteThis is one possible solution of the example:   These are examples of wrong solutions:   The above solution is wrong because it doesn't use the minimum number of edges (4 vs 3). In addition, it also tries to construct a road between cities 1 and 3, while the input specifies that it is not allowed to construct a road between the pair.   The above solution is wrong because you need to traverse at least 3 roads to go from city 1 to city 3, whereas in your country it must be possible to go from any city to another by traversing at most 2 roads.   Finally, the above solution is wrong because it must be possible to go from any city to another, whereas it is not possible in this country to go from city 1 to 3, 2 to 3, and 4 to 3.

print(function(n, m) {

	var not = new Int8Array(n + 1);
	while (m--)
		rn().reduce(function(a, b){
			not[a]=1;
			not[b]=1;
		});
	var c = 0;
	for(var i=1; i<=n; i++)
		if(not[i]===0){
			c=i;
			break;
		}

	var ans = [n-1];
	for(var i=1; i<=n; i++)
		if(i!==c)
			ans.push(c+' '+i);

	return ans.join('\n');

} .apply(0, rn()));
function rn() {
	return readline().split(' ').map(Number);
}

;(function () {
	print(function () {
		var l = readline().split(' ').map(Number), n = l[0], m = l[1], a = [];
		while (m--) { a.push(readline().split(' ').map(Number)); }

		var t = [];
		for (var i = 0; i < n; i++) { t.push(true); }
		a.forEach(function (e) { t[e[0] - 1] = t[e[1] - 1] = false; });
		t = t.map(function (e, i) { return e ? i + 1 : false; }).filter(function (e) { return e === parseInt(e); });

		return [n - 1].concat(function (a, n) {
			var ret = [];
			for (var i = 0; i < n; i++) {
				if (i+1 !== a) {
					ret.push([a, i+1].join(' '));
				}
			}

			return ret;
		}(t[0], n)).join('\n')
	}());
}).call(this);

function main(str) {
    var arr = str.split(' ');
    var num1 = +arr[0];
    var num2 = +arr[1];

    var myGraph;

    // конструктор графа
    var Graph = function (nodes) {
        this.nodesNumber = nodes;
        this.edgesNumber = 0;
        this.nodes = new Array(this.nodesNumber);
        var i = 0;

        for (i; i < nodes; i++) {
            this.nodes[i] = [];
        }

        this.connectNodes = function (v, w) {
            this.nodes[v].push(w);
            this.nodes[w].push(v);
            this.edgesNumber++;
        }

        this.showGraph = function () {
            var i = 0;
            var j = 0;
            write(this.edgesNumber + '\n');
            for (i; i < this.nodes.length; i++) {
                for (j; j < this.nodes[i].length; j++) {
                    var resStr = (i + 1) + ' ' + (this.nodes[i][j] + 1) + '\n';
                    write(resStr);
                }
            }
        }
    }

    function logic() {
        myGraph = new Graph(num1);
        var centralNode = 0;
        var nodesUnderCondition = new Set();
        var i = 0;
        var j = 0;
        var k = 0;
        for (j;j<num2;j++) {
            var str = readline();
            var arr = str.split(' ');
            var node1 = arr[0] - 1;
            var node2 = arr[1] - 1;
            nodesUnderCondition.add(node1);
            nodesUnderCondition.add(node2);
        }

        for (k;k<num1;k++) {
            if (!nodesUnderCondition.has(k)) {
                centralNode = k;
            }
        }

        for (i; i < num1; i++) {
            if (i !== centralNode) {
                myGraph.connectNodes(i, centralNode);
            }
        }

        myGraph.showGraph();
    }

    logic();
}

var data = readline();
main(data);

var input = readline().split(' ').map(Number), n = input[0], m = input[1];
var no = [];
for (var i = 0; i < n; i++) no[i] = (new Set()).add(i);
while (m--) {
    input = readline().split(' ').map(Number);
    var a = --input[0];
    var b = --input[1];
    no[a].add(b);
    no[b].add(a);
}

var res = [];
var doneFlag = false;

while (!doneFlag) {
    var minr = Infinity;
    var minidx = 0;
    for (var i = 0; i < n; i++) {
        if (minr > no[i].size) {
            minr = no[i].size;
            minidx = i;
        }
    }

    var connected = [];
    for (var i = 0; i < n; i++) {
        if (!no[minidx].has(i)) {
            res.push((minidx+1) + ' ' + (i+1));
            connected.push(i);
            no[minidx].add(i);
			no[i].add(minidx);
        }
    }

    doneFlag = true;
    for (var i = 0; i < connected.length; i++) {
        for (var j = 0; j < connected.length; j++) {
            no[connected[i]].add(connected[j]);
			no[connected[j]].add(connected[i]);
		}
        if (no[i].size < n) {
            doneFlag = false;
            break;
        }
    }

}

write(res.length + '\n' + res.join('\n'));

function main(str) {
    var arr = str.split(' ');
    var num1 = +arr[0];
    var num2 = +arr[1];

    var myGraph;

    // конструктор графа
    var Graph = function (nodes) {
        this.nodesNumber = nodes;
        this.edgesNumber = 0;
        this.nodes = new Array(this.nodesNumber);
        var i = 0;

        for (i; i < nodes; i++) {
            this.nodes[i] = [];
        }

        this.connectNodes = function (node1, node2) {
            this.nodes[node1].push(node2);
            this.nodes[node2].push(node1);
            this.edgesNumber++;
        }

        this.showGraph = function () {
            var i = 0;
            var j = 0;
            write(this.edgesNumber);
            for (i; i < this.nodes.length; i++) {
                for (j; j < this.nodes[i].length; j++) {
                    write((i + 1) + ' ' + (this.nodes[i][j] + 1));
                }
            }
        }
    }

    function logic() {
        myGraph = new Graph(num1);
        var centralNode = 0;
        var nodesUnderCondition = new Set();
        var i = 0;
        var j = 0;
        var k = 0;
        for (j;j<num2;j++) {
            var str = readline();
            var arr = str.split(' ');
            var node1 = +arr[0];
            var node2 = +arr[1];
            nodesUnderCondition.add(node1);
            nodesUnderCondition.add(node2);
        }

        for (k;k<num1;k++) {
            if (!nodesUnderCondition.has(k)) {
                centralNode = k;
            }
        }

        for (i; i < num1; i++) {
            if (i !== centralNode) {
                myGraph.connectNodes(i, centralNode);
            }
        }

        myGraph.showGraph();
    }

    logic();
}

var data = readline();
main(data);

function main(str) {
    var arr = str.split(' ');
    var num1 = +arr[0];
    var num2 = +arr[1];

    var myGraph;

    // конструктор графа
    var Graph = function (nodes) {
        this.nodesNumber = nodes;
        this.edgesNumber = 0;
        this.nodes = new Array(this.nodesNumber);
        var i = 0;

        for (i; i < nodes; i++) {
            this.nodes[i] = [];
        }

        this.connectNodes = function (v, w) {
            this.nodes[v].push(w);
            this.nodes[w].push(v);
            this.edgesNumber++;
        }

        this.showGraph = function () {
            var i = 0;
            var j = 0;
            write(this.edgesNumber + '\n');
            for (i; i < this.nodes.length; i++) {
                for (j; j < this.nodes[i].length; j++) {
                    var resStr = (i + 1) + ' ' + (this.nodes[i][j] + 1) + '\n';
                    write(resStr);
                }
            }
        }
    }

    function logic() {
        myGraph = new Graph(num1);
        var centralNode = 0;
        var nodesUnderCondition = new Set();
        var i = 0;
        var j = 0;
        var k = 0;
        for (j;j<num2;j++) {
            var str = readline();
            var arr = str.split(' ');
            var node1 = +arr[0];
            var node2 = +arr[1];
            nodesUnderCondition.add(node1);
            nodesUnderCondition.add(node2);
        }

        for (k;k<num1;k++) {
            if (!nodesUnderCondition.has(k)) {
                centralNode = k;
            }
        }

        for (i; i < num1; i++) {
            if (i !== centralNode) {
                myGraph.connectNodes(i, centralNode);
            }
        }

        myGraph.showGraph();
    }

    logic();
}

var data = readline();
main(data);

function main(str) {
    var arr = str.split(' ');
    var num1 = +arr[0];
    var num2 = +arr[1];

    var myGraph;

    // конструктор графа
    var Graph = function (nodes) {
        this.nodesNumber = nodes;
        this.edgesNumber = 0;
        this.nodes = new Array(this.nodesNumber);
        var i = 0;

        for (i; i < nodes; i++) {
            this.nodes[i] = [];
        }

        this.connectNodes = function (v, w) {
            this.nodes[v].push(w);
            this.nodes[v].push(w);
            this.edgesNumber++;
        }

        this.showGraph = function () {
            var i = 0;
            var j = 0;
            write(this.edgesNumber);
            for (i; i < this.nodes.length; i++) {
                for (j; j < this.nodes[i].length; j++) {
                    write((i + 1) + ' ' + (this.nodes[i][j] + 1));
                }
            }
        }
    }

    function logic() {
        myGraph = new Graph(num1);
        var centralNode = 0;
        var nodesUnderCondition = new Set();
        var i = 0;
        var j = 0;
        var k = 0;
        for (j;j<num2;j++) {
            var str = readline();
            var arr = str.split(' ');
            var node1 = +arr[0];
            var node2 = +arr[1];
            nodesUnderCondition.add(node1);
            nodesUnderCondition.add(node2);
        }

        for (k;k<num1;k++) {
            if (!nodesUnderCondition.has(k)) {
                centralNode = k;
            }
        }

        for (i; i < num1; i++) {
            if (i !== centralNode) {
                myGraph.connectNodes(i, centralNode);
            }
        }

        myGraph.showGraph();
    }

    logic();
}

var data = readline();
main(data);

function main(str) {
    var arr = str.split(' ');
    var num1 = +arr[0];
    var num2 = +arr[1];

    var myGraph;

    // конструктор графа
    var Graph = function (nodes) {
        this.nodesNumber = nodes;
        this.edgesNumber = 0;
        this.nodes = new Array(this.nodesNumber);
        var i = 0;

        for (i; i < nodes; i++) {
            this.nodes[i] = [];
        }

        this.connectNodes = function (v, w) {
            this.nodes[v].push(w);
            this.nodes[w].push(v);
            this.edgesNumber++;
        }

        this.showGraph = function () {
            var i = 0;
            var j = 0;
            write(this.edgesNumber);
            for (i; i < this.nodes.length; i++) {
                for (j; j < this.nodes[i].length; j++) {
                    var resStr = (i + 1) + ' ' + (this.nodes[i][j] + 1);
                    write(resStr);
                }
            }
        }
    }

    function logic() {
        myGraph = new Graph(num1);
        var centralNode = 0;
        var nodesUnderCondition = new Set();
        var i = 0;
        var j = 0;
        var k = 0;
        for (j;j<num2;j++) {
            var str = readline();
            var arr = str.split(' ');
            var node1 = +arr[0];
            var node2 = +arr[1];
            nodesUnderCondition.add(node1);
            nodesUnderCondition.add(node2);
        }

        for (k;k<num1;k++) {
            if (!nodesUnderCondition.has(k)) {
                centralNode = k;
            }
        }

        for (i; i < num1; i++) {
            if (i !== centralNode) {
                myGraph.connectNodes(i, centralNode);
            }
        }

        myGraph.showGraph();
    }

    logic();
}

var data = readline();
main(data);


You are given a positive integer $$$n$$$, it is guaranteed that $$$n$$$ is even (i.e. divisible by $$$2$$$).You want to construct the array $$$a$$$ of length $$$n$$$ such that:   The first $$$\frac{n}{2}$$$ elements of $$$a$$$ are even (divisible by $$$2$$$);  the second $$$\frac{n}{2}$$$ elements of $$$a$$$ are odd (not divisible by $$$2$$$);  all elements of $$$a$$$ are distinct and positive;  the sum of the first half equals to the sum of the second half ($$$\sum\limits_{i=1}^{\frac{n}{2}} a_i = \sum\limits_{i=\frac{n}{2} + 1}^{n} a_i$$$). If there are multiple answers, you can print any. It is not guaranteed that the answer exists.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ test cases follow. The only line of the test case contains one integer $$$n$$$ ($$$2 \le n \le 2 \cdot 10^5$$$) — the length of the array. It is guaranteed that that $$$n$$$ is even (i.e. divisible by $$$2$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 \cdot 10^5$$$ ($$$\sum n \le 2 \cdot 10^5$$$).

For each test case, print the answer — "NO" (without quotes), if there is no suitable answer for the given test case or "YES" in the first line and any suitable array $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^9$$$) satisfying conditions from the problem statement on the second line.

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var evenSide = [];
  var oddSide = [];
  if ((n / 2) % 2 != 0) print("No");
  else {
    var evenSum = 0;
    var oddSum = 0;
    for (var i = 2; i <= n; i += 2) {
      evenSide.push(i);
      oddSide.push(i - 1);
      evenSum += i;
      oddSum += i - 1;
    }
    if ((evenSum - oddSum) % 2 == 0) {
      oddSide[oddSide.length - 1] += evenSum - oddSum;
      print("Yes", "\n", evenSide.concat(oddSide).join(" "));
    } else print("No");
  }
}
/*function findx(n) {
  var evenSide = [];
  var oddSide = [];
  if ((n / 2) % 2 != 0) console.log("No");
  else {
    var evenSum = 0;
    var oddSum = 0;
    for (var i = 2; i <= n; i += 2) {
      evenSide.push(i);
      oddSide.push(i - 1);
      evenSum += i;
      oddSum += i - 1;
    }
    if ((evenSum - oddSum) % 2 == 0) {
      oddSide[oddSide.length - 1] += evenSum - oddSum;
      console.log("Yes", "\n", evenSide.concat(oddSide));
    } else console.log("No");
  }
}
findx(4);*/

// this is js
var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0, sum2 = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{   sum2+= 2*(j-stop)-1
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum-sum2)
		print('YES')
		print(array.join(' '))
	}
}

// Don't know where the future lies
var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0, sum2 = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{   sum2+= 2*(j-stop)-1
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum-sum2)
		print('YES')
		print(array.join(' '))
	}
}

// Just wandering on the pale blue dot
var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0, sum2 = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{   sum2+= 2*(j-stop)-1
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum-sum2)
		print('YES')
		print(array.join(' '))
	}
}

// very experimental, but faster than python3
var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0, sum2 = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{   sum2+= 2*(j-stop)-1
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum-sum2)
		print('YES')
		print(array.join(' '))
	}
}

// I truly believe that i am wasting my time with these programming questions
var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0, sum2 = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{   sum2+= 2*(j-stop)-1
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum-sum2)
		print('YES')
		print(array.join(' '))
	}
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
//atcoderのサンプルは最後に改行入れること
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
    var t = nextInt();
	var output = [];
	for(var i = 0; i < t; i++){
		var n = nextInt();
		if(n % 4 != 0){
			output.push("NO");
		}else{
			n /= 2;
			var sum = 0;
			var list = [];
			for(var j = 1; j <= n; j++){
				list.push(j * 2);
				sum += (j * 2);
			}
			for(var j = 1; j < n; j++){
				list.push((j * 2) - 1);
				sum -= (j * 2) - 1;
			}
			list.push(sum);
			output.push("YES");
			output.push(myconv(list,8));
		}
	}
	myout(myconv(output,9));
}

var testsAmount = parseInt(readline());

var tests = [];
for (var i = 0; i < testsAmount; i++) {
  tests.push(parseInt(readline()));
}

for (var i = 0; i < tests.length; i++) {
  if (tests[i] % 4 > 0) {
    print('NO');

    continue;
  }

  var first = '';
  var second = '';
  for (var j = 1; j <= tests[i]; j++) {
    if (j % 2 === 0) {
      first += ' ' + j;
    } else {
      second += ' ' + (j === tests[i] - 1 ? (j + tests[i]/2) : j);
    }
  }

  print('YES');
  print(first.slice(1) + second);
}

  var testsAmount = parseInt(readline());

  var tests = [];
  for (var i = 0; i < testsAmount; i++) {
    tests.push(parseInt(readline()));
  }

  for (var i = 0; i < tests.length; i++) {
    if (tests[i] % 4 > 0) {
      print('NO');

      continue;
    }

    var first = [];
    var second = [];
    for (var j = 1; j <= tests[i]; j++) {
      if (j % 2 === 0) {
        first.push(j);
      } else {
        second.push(j === tests[i] - 1 ? (j + tests[i]/2) : j);
      }
    }

    print('YES');
    print(first.join(' ') + ' ' + second.join(' '));
  }

  var testsAmount = parseInt(readline());

  var tests = [];
  for (var i = 0; i < testsAmount; i++) {
    tests.push(parseInt(readline()));
  }

  for (var i = 0; i < tests.length; i++) {
    if (tests[i] % 4 > 0) {
      print('NO');

      continue;
    }

    var first = [];
    var second = [];
    for (var j = 1; j <= tests[i]; j++) {
      if (j % 2 === 0) {
        first.push(j);
      } else {
        second.push(j);
      }
    }

    second[second.length - 1] = second[second.length - 1] + tests[i] / 2;

    print('YES');
    print(first.join(' ') + ' ' + second.join(' '));
  }

var testsAmount = parseInt(readline());

var tests = [];
for (var i = 0; i < testsAmount; i++) {
  tests.push(parseInt(readline()));
}

for (var i = 0; i < tests.length; i++) {
  var first = {arr:[],sum:0};
  var second = {arr:[],sum:0};
  for (var j = 1; j <= tests[i]; j++) {
    if (j % 2 === 0) {
      first.arr.push(j);
      first.sum += j;

      if (j === tests[i]) {
        if (first.sum !== second.sum) {
          print('NO');
        } else {
          print('YES');
          print(first.arr.join(' ') + ' ' + second.arr.join(' '));
        }
      }

      continue;
    }

    if (j === tests[i] - 1) {
      if (((first.sum + j + 1) - second.sum) % 2 > 0) {
        second.arr.push((first.sum + j + 1) - second.sum);
        second.sum += (first.sum + j + 1) - second.sum;
      }
    } else {
      second.arr.push(j);
      second.sum += j;
    }
  }
}

var t = parseInt(readline());

for(var qq = 0; qq < t; qq++) {
    var n = parseInt(readline());
    var ndel2 = n / 2;

    if (ndel2 % 2 === 0) {
        var a = [2];
        var b = [1];

        for(var i = 1; i < ndel2; i++) {
            a[i] = a[i - 1] + 2;

            if (i == ndel2 / 2) {
                b[i] = b[i - 1] + 4;
            } else {
                b[i] = b[i - 1] + 2;
            }
        }

        print('YES');
        print(a.concat(b).join(' '));

    } else {
        print('NO');
    }

}

var range = readline();

for(var i=0;i<range;i++) {
    var input = parseInt(readline());
    var divisior = input / 2;
    var even = [];
    var odd = [];

    if(divisior % 2 !== 0) {
        print("NO");
    }else {
        print("YES");
        var index = 1;
        var generate = 0;

        while(generate !== input) {
            generate = 2 * index;
            even.push(generate);
            index++;
        }

        for(var j=0;j<(index - 1)/2;j++) {
            if(even[j]) {
                odd.push(even[j] - 1);

            }
        }

        for(var j=(index -1)/2;j<index;j++) {
            if(even[j]) {
                odd.push(even[j] + 1);
            }
        }

        print(even.join(" ") + " " + odd.join(" "))
    }
}

const readline = require('readline');

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

let l = 0;
let lines = [];
rl.on('line', (line) => {
  if (!l) {
    l = +line
  } else {
    lines.push(+line);
  }
}).on('close', () => {
  for(q = 0; q < lines.length; q++) {
    const n = lines[q];
    const centre = n / 2;
    let o;
    const x = [];
    const y = [];
    let summ = 0;
    let summ2 = 1;
    if (centre % 2 !== 0) {
      o = 'NO'
    } else {
      o = 'YES'
      for (i = 1, j = 1; i <= centre; i++, j+= 2) {
        x.push(2 * i)
        summ += 2 * i;

        if (i === 1) {
          y.push(1)
        } else {
          if (i !== centre) {
            y.push(j)
            summ2 += j
          } else{
            y.push(summ - summ2)
            summ2 += summ - summ2
          }
        }
      }
    }

    process.stdout.write(`${o}\n`);
    o === "YES" && process.stdout.write(`${[...x, ...y].join(' ')}\n`);
  }
});

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

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

  let sum = 0;
  let even = 2;
  let odd = 1;
  let i = 0;
  const left = [];
  const right = [];
  while (i < +d - 1) {
    if (i % 2 === 0) {
      left.push(even);
      sum += even;
      even += 2;
    }
    else {
      right.push(odd);
      sum -= odd;
      odd += 2;
    }

    i++;
  }

  if (sum % 2 === 0) {
    console.log('NO');
  }
  else {
    console.log('YES');
    const ans = [...left, ...right, sum];
    console.log(ans.join(' '));
  }

  // let ans = [];
  // let v = +d;

  // let value = 2;
  // for (let i = 0; i < v / 2; i++) {
  //   ans.push(value);
  //   value += 2;
  // }

  // let sum = ans.reduce((acc, x) => acc + x, 0);

  // value = 1;
  // for (let i = v / 2; i < v - 1; i++) {
  //   ans.push(value);
  //   sum -= value;
  //   value += 2;
  // }

  // if (sum % 2 === 0) {
  //   console.log('NO');
  // }
  // else {
  //   ans.push(sum);
  //   console.log('YES');
  //   console.log(ans.join(' '));
  // }

  c++;
});

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

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

  let ans = [];
  let v = +d;

  let value = 2;
  for (let i = 0; i < v / 2; i++) {
    ans.push(value);
    value += 2;
  }

  let sum = ans.reduce((acc, x) => acc + x, 0);

  value = 1;
  for (let i = v / 2; i < v - 1; i++) {
    ans.push(value);
    sum -= value;
    value += 2;
  }

  if (sum % 2 === 0) {
    console.log('NO');
  }
  else {
    ans.push(sum);
    console.log('YES');
    console.log(ans.join(' '));
  }

  c++;
});

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

const input = [];

function splitAndParseInt(line) {
  return line.split(" ").map((x) => parseInt(x));
}

readLine.on("line", (line) => input.push(line));
readLine.on("close", () => {
  let t = parseInt(input[0]);

  for (let i = 1; i <= t; i += 1) {
    const n = parseInt(input[i]);

    if ((n / 2) % 2 !== 0) {
      console.log("NO");
      continue;
    }

    const size = n / 2;
    const answer = [];

    let sumLeft = 0;
    for (let i = 0, j = 2; i < size; i += 1, j += 2) {
      answer.push(j);
      sumLeft += j;
    }

    let sumRight = 0;
    for (let i = 0, j = 1; i < size - 1; i += 1, j += 2) {
      answer.push(j);
      sumRight += j;
    }

    answer.push(sumLeft - sumRight);
    console.log(`YES`);
    console.log(answer.join(" "));
  }
});

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

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

let inputString = "";
let currentLine = 0;

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

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

function main() {
    var input = parseInt(readline())
    //var a = readline().split(" ").map(x => parseInt(x))
    while (input--) {
        var n = parseInt(readline())
        var half = n / 2
        if (half % 2 == 1) print("NO")
        else {
            var evenarr = [], oddarr = []
            for (var i = 2; i <= n; i += 2) {
                evenarr.push(i)
                oddarr.push(i - 1)
            }
            oddarr[half - 1] = oddarr[half - 1] + half
            print("YES")
            print(evenarr.join(" ")+" "+oddarr.join(" "))
        }

    }

}

function solve(n) {
  const a = (n % 4);
  let result = [];
  if (a === 0) {
    result = new Array(n);
    const k = (n / 2);
    let s = 0;
    for (let i = 0; i < k; i = i + 1) {
      result[i] = i + i + 2;
      s = s + result[i];
    }
    let t = 0;
    for (let i = 0; i < (k - 1); i = i + 1) {
      const u = k + i;
      result[u] = i + i + 1;
      t = t + result[u];
    }
    result[n - 1] = s - t;
  }
  return result;
}

function main(lines) {
  const yes = 'YES';
  const no = 'NO';
  lines.shift();
  for (const line of lines) {
    const a = Number(line);
    const result = solve(a);
    if (result.length === 0) {
      console.log(no);
    } else {
      console.log(yes);
      console.log(result.join(' '));
    }
  }
}

function trim_line(s) {
  return s.trim();
}

function has_content(s) {
  return (s.length > 0);
}

async function processLinesFromStream(rs, pf) {
  const chunks = [];
  const encoding = 'utf-8';
  rs.setEncoding(encoding);
  for await (let chunk of rs) {
    chunks.push(chunk);
  }
  const empty = '';
  const newline = /\n/;
  const lines = chunks.join(empty)
                      .split(newline)
                      .map(trim_line)
                      .filter(has_content);
  const result = pf(lines);
  return result;
}

processLinesFromStream(process.stdin, main);

function solve(n) {
  const a = (n % 4);
  let result = [];
  if (a === 0) {
    result = new Array(n);
    const k = (n / 2);
    let s = 0;
    for (let i = 0; i < k; i = i + 1) {
      result[i] = i + i + 2;
      s = s + result[i];
    }
    let t = 0;
    for (let i = 0; i < (k - 1); i = i + 1) {
      const u = k + i;
      result[u] = i + i + 1;
      t = t + result[u];
    }
    result[n - 1] = s - t;
  }
  return result;
}

function main(lines) {
  const yes = "YES";
  const no = "NO";
  lines.shift();
  for (const line of lines) {
    let t = line.trim();
    if (line.length > 0) {
      const a = Number(t);
      const result = solve(a);
      if (result.length === 0) {
        console.log(no);
      } else {
        console.log(yes);
        console.log(result.join(' '));
      }
    }
  }
}

async function processLinesFromStream(rs, pf) {
  const content = [];
  rs.setEncoding("utf-8");
  for await (let chunk of rs) {
    content.push(chunk);
  }
  const lines = content.join('').split(/\n/);
  const result = pf(lines);
  return result;
}

processLinesFromStream(process.stdin, main);

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

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

function solve(n) {
  if (n % 4 !== 0) return -1;
  let even = [2];
  let sumEven = 2;
  let odd = [1];
  let sumOdd = 1;
  while (odd.length < n / 2) {
    let nextEven = even[even.length - 1] + 2;
    sumEven += nextEven;
    even.push(nextEven);
    let nextOdd = odd[odd.length - 1] + 2;
    sumOdd += nextOdd;
    odd.push(nextOdd);
  }
  odd[odd.length - 1] = sumEven - sumOdd + odd[odd.length - 1];
  return even.concat(odd);
}

function main() {
  const t = parseInt(readLine());
  for (let i = 0; i < t; i++) {
    let n = parseInt(readLine());
    // let a = readLine().split(' ').map((val) => parseInt(val));
    let res = solve(n);
    if (res === -1) console.log('NO');
    else {
      console.log('YES');
      console.log(res.join(' '));
    }
    // console.log(res);
  }
  //process.stdout.write("hello: ");
}

// Sample code to perform I/O:

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

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

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

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

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

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

    let inputs = str.trim().split('\n');
    //let testResult = [];
    for (let index = 1; index <= +inputs[0]; index++) {
        const element = +inputs[index];

        if (element % 4 !== 0) {
            console.log('NO');
            // testResult.push('NO');
            continue;
        }
        let arr = { odd: [], even: [] };
        for (let index2 = 1; index2 <= element; index2++) {

            if (index2 % 2 == 0) {
                arr.even.push(index2);
            }
            else {
                arr.odd.push(index2);
            }
        }

        arr.odd[arr.odd.length - 1] = arr.odd[arr.odd.length - 1] + Math.floor(element / 2);
        console.log('YES');
        console.log(arr.even.join(' '), arr.odd.join(' '));

    }
    //console.log(testResult);
    // return ' '.toString();

}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function main() {
    let t = parseInt(readLine());
    for (var i = 0; i < t; i++) {
        let n = parseInt(readLine());
        if ((n / 2) % 2 == 1) {
            console.log('NO');
        } else {
            console.log('YES');
            let even = [];
            let odd = [];
            let j = 2;
            let oke = 1;
            while (true) {
                even.push(j);
                if (odd.length >= n / 4) {
                    odd.push(j + 1);
                } else odd.push(j - 1);
                j += 2;
                if (even.length == n / 2 && odd.length == n / 2) break;
            }
            console.log(even.concat(odd).join(' '))
        }
    }
}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  //let [n, industry] = readline().split(" ").map(e => parseInt(e));

    let cases = parseInt(readline(), 10);
    for (var X = 0; X < cases; X++) {
      const n = parseInt(readline(), 10);
      const half = n / 2;

      if (half % 2 !== 0) {
        // const odd = [half-1, half+1];
        // const even = [half-2, half+2];
        console.log('NO');
        // console.log([...odd, ...even].join(" "))
      } else {
        let odd = [];
        let even = [];

        let c = 2;
        for (var i = 0; i < half; i++) {
          odd.push(c);
          c+= 2;
        }
        const sumOdd = odd.reduce((a,b) => a+b, 0);

        c = 1;
        for (var i = 0; i < half-1; i++) {
          even.push(c);
          c += 2;
        }
        even.push(sumOdd - even.reduce((a,b) => a+b, 0))

        console.log('YES');
        console.log([...odd, ...even].join(" "))
      }

    }

}

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var evenSide = [];
  var oddSide = [];
  if ((n / 2) % 2 != 0) print("No");
  else {
    var evenSum = 0;
    var oddSum = 0;
    for (var i = 2; i <= n; i += 2) {
      evenSide.push(i);
      oddSide.push(i - 1);
      evenSum += i;
      oddSum += i - 1;
    }
    if ((evenSum - oddSum) % 2 == 0) {
      oddSide[oddSide.length - 1] += evenSum - oddSum;
      print("Yes", "\n", evenSide.concat(oddSide).join(","));
    } else print("No");
  }
}
/*function findx(n) {
  var evenSide = [];
  var oddSide = [];
  if ((n / 2) % 2 != 0) console.log("No");
  else {
    var evenSum = 0;
    var oddSum = 0;
    for (var i = 2; i <= n; i += 2) {
      evenSide.push(i);
      oddSide.push(i - 1);
      evenSum += i;
      oddSum += i - 1;
    }
    if ((evenSum - oddSum) % 2 == 0) {
      oddSide[oddSide.length - 1] += evenSum - oddSum;
      console.log("Yes", "\n", evenSide.concat(oddSide));
    } else console.log("No");
  }
}
findx(4);*/

var t = parseInt(readline());
for (var tc = 0; tc < t; tc++) {
  var n = parseInt(readline());
  var evenSide = [];
  var oddSide = [];
  if ((n / 2) % 2 != 0) print("No");
  else {
    var evenSum = 0;
    var oddSum = 0;
    for (var i = 2; i <= n; i += 2) {
      evenSide.push(i);
      oddSide.push(i - 1);
      evenSum += i;
      oddSum += i - 1;
    }
    if ((evenSum - oddSum) % 2 == 0) {
      oddSide[oddSide.length - 1] += evenSum - oddSum;
      print("Yes", "\n", evenSide.concat(oddSide));
    } else print("No");
  }
}
/*function findx(n) {
  var evenSide = [];
  var oddSide = [];
  if ((n / 2) % 2 != 0) console.log("No");
  else {
    var evenSum = 0;
    var oddSum = 0;
    for (var i = 2; i <= n; i += 2) {
      evenSide.push(i);
      oddSide.push(i - 1);
      evenSum += i;
      oddSum += i - 1;
    }
    if ((evenSum - oddSum) % 2 == 0) {
      oddSide[oddSide.length - 1] += evenSum - oddSum;
      console.log("Yes", "\n", evenSide.concat(oddSide));
    } else console.log("No");
  }
}
findx(4);*/

var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{
			array.push(2*(j-stop+1)-1)
		}
	}
		array.push(sum - array[value-2])
		print('YES')
		print(array.join(' '))
	}
}

var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0, sum2 = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{   sum2+= 2*(j-stop)-1
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum2 - array[value-2])
		print('YES')
		print(array.join(' '))
	}
}

var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  < stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{
			array.push(2*(j-stop+1)-1)
		}
	}
		array.push(sum - array[value-2])
		print('YES')
		print(array.join(' '))
	}
}

var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0
	if ((value/2)%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  <= stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{
			array.push(2*(j-stop)-1)
		}
	}
		array.push(sum - array[value-2])
		print('YES')
		print(array.join(' '))
	}
}

var tests = parseInt(readline()), value = 0, stop = 0;
for (var i = 0; i < tests; i++)
	{
	value = parseInt(readline())
	stop = value/2
	var array = [], sum = 0
	if (value%2) print('NO')
	else{
	for (var j = 1; j < value; j++)
		{
		if (j  < stop)
		{
			sum += 2*(j)
			array.push(2*(j))
		}
		else
		{
			array.push(2*(j-stop+1)-1)
		}
	}
		array.push(sum - array[value-2])
		print('YES')
		print(array.join(' '))
	}
}

Main();
function myout(t){print(t);}//standard output
function next(){return readline();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す
//6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
//atcoderのサンプルは最後に改行入れること
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main() {
    var t = nextInt();
	var output = [];
	for(var i = 0; i < t; i++){
		var n = nextInt();
		if(n % 4 != 0){
			output.push("NO");
		}else{
			n /= 2;
			var sum = 0;
			var list = [];
			for(var i = 1; i <= n; i++){
				list.push(i * 2);
				sum += (i * 2);
			}
			for(var i = 1; i < n; i++){
				list.push((i * 2) - 1);
				sum -= (i * 2) - 1;
			}
			list.push(sum);
			output.push("YES");
			output.push(myconv(list,8));
		}
	}
	myout(myconv(output,9));
}

var testsAmount = parseInt(readline());

var tests = [];
for (var i = 0; i < testsAmount; i++) {
  tests.push(parseInt(readline()));
}

for (var i = 0; i < tests.length; i++) {
  if (tests[i] % 4 > 0) {
    print('NO');

    continue;
  }

  var first = '';
  var second = '';
  for (j = 1; j <= tests[i]; j++) {
    if (j % 2 === 0) {
      first += ' ' + j;
    } else {
      second += ' ' + j;
    }
  }

  print(first.slice(1) + second);
}

var testsAmount = parseInt(readline());

var tests = [];
for (var i = 0; i < testsAmount; i++) {
  tests.push(parseInt(readline()));
}

for (var i = 0; i < tests.length; i++) {
  if (tests[i] % 4 > 0) {
    print('NO');

    continue;
  }

  var first = '';
  var second = '';
  for (j = 1; j <= tests[i]; j++) {
    if (j % 2 === 0) {
      first += ' ' + j;
    } else {
      second += ' ' + (j === tests[i] - 1 ? (j + tests[i]/2) : j);
    }
  }

  print(first.slice(1) + second);
}

var testsAmount = parseInt(readline());

var tests = [];
for (var i = 0; i < testsAmount; i++) {
  tests.push(parseInt(readline()));
}

for (var i = 0; i < tests.length; i++) {
  if (tests[i] % 4 > 0) {
    print('NO');

    continue;
  }

  var first = '';
  var second = '';
  for (var j = 1; j <= tests[i]; j++) {
    if (j % 2 === 0) {
      first += ' ' + j;
    } else {
      second += ' ' + (j === tests[i] - 1 ? (j + tests[i]/2) : j);
    }
  }

  print(first.slice(1) + second);
}

var t = parseInt(readline());

for(var qq = 0; qq < t; qq++) {
    var n = parseInt(readline());
    var ndel2 = n / 2;

    if (ndel2 % 2 === 0) {
        var a = [2];
        var b = [1];

        for(var i = 1; i < ndel2; i++) {
            a[i] = a[i - 1] + 2;

            if (i == ndel2 / 2) {
                b[i] = b[i - 1] + 4;
            } else {
                b[i] = b[i - 1] + 2;
            }
        }

        print(a.concat(b).join(' '));

    } else {
        print('NO');
    }

}

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

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

let inputString = "";
let currentLine = 0;

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

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

function main() {
    var input = parseInt(readline())
    //var a = readline().split(" ").map(x => parseInt(x))
    while (input--) {
        var n = parseInt(readline())
        var half = n / 2
        if (half % 2 == 1) print("NO")
        else {
            var evenarr = [], oddarr = []
            for (var i = 2; i <= n; i += 2) {
                evenarr.push(i)
                oddarr.push(i - 1)
            }
            oddarr[half - 1] = oddarr[half - 1] + half
            print("YES")
            print(evenarr.join(" "), oddarr.join(" "))
        }

    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  //let [n, industry] = readline().split(" ").map(e => parseInt(e));

    let cases = parseInt(readline(), 10);
    for (var i = 0; i < cases; i++) {
      const n = parseInt(readline(), 10);
      const half = n / 2;

      if (half % 2 !== 0) {
        console.log('NO');
      } else {
        let odd = [];
        let even = [];

        let c = 2;
        for (var i = 0; i < half; i++) {
          odd.push(c);
          c+= 2;
        }
        const sumOdd = odd.reduce((a,b) => a+b, 0);

        c = 1;
        for (var i = 0; i < half-1; i++) {
          even.push(c);
          c += 2;
        }
        even.push(sumOdd - even.reduce((a,b) => a+b, 0))

        console.log('YES');
        console.log([...odd, ...even].join(" "))
      }

    }

}

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

function readline() {
    return inputString[currentLine++];
}
// Make a Snippet for the code above this and then write your logic in main();

function main() {
  //let [n, industry] = readline().split(" ").map(e => parseInt(e));

    let cases = parseInt(readline(), 10);
    for (var i = 0; i < cases; i++) {
      const n = parseInt(readline(), 10);
      const half = n / 2;

      if (half % 2 !== 0) {
        // const odd = [half-1, half+1];
        // const even = [half-2, half+2];
        console.log('NO');
        // console.log([...odd, ...even].join(" "))
      } else {
        let odd = [];
        let even = [];

        let c = 2;
        for (var i = 0; i < half; i++) {
          odd.push(c);
          c+= 2;
        }
        const sumOdd = odd.reduce((a,b) => a+b, 0);

        c = 1;
        for (var i = 0; i < half-1; i++) {
          even.push(c);
          c += 2;
        }
        even.push(sumOdd - even.reduce((a,b) => a+b, 0))

        console.log('YES');
        console.log([...odd, ...even].join(" "))
      }

    }

}