It's time polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got down to business. In total, there are n tasks for the day and each animal should do each of these tasks. For each task, they have evaluated its difficulty. Also animals decided to do the tasks in order of their difficulty. Unfortunately, some tasks can have the same difficulty, so the order in which one can perform the tasks may vary.Menshykov, Uslada and Horace ask you to deal with this nuisance and come up with individual plans for each of them. The plan is a sequence describing the order in which an animal should do all the n tasks. Besides, each of them wants to have its own unique plan. Therefore three plans must form three different sequences. You are to find the required plans, or otherwise deliver the sad news to them by stating that it is impossible to come up with three distinct plans for the given tasks.

The first line contains integer n (1 ≤ n ≤ 2000) — the number of tasks. The second line contains n integers h1, h2, ..., hn (1 ≤ hi ≤ 2000), where hi is the difficulty of the i-th task. The larger number hi is, the more difficult the i-th task is.

In the first line print "YES" (without the quotes), if it is possible to come up with three distinct plans of doing the tasks. Otherwise print in the first line "NO" (without the quotes). If three desired plans do exist, print in the second line n distinct integers that represent the numbers of the tasks in the order they are done according to the first plan. In the third and fourth line print two remaining plans in the same form. If there are multiple possible answers, you can print any of them.

NoteIn the first sample the difficulty of the tasks sets one limit: tasks 1 and 4 must be done before tasks 2 and 3. That gives the total of four possible sequences of doing tasks : [1, 4, 2, 3], [4, 1, 2, 3], [1, 4, 3, 2], [4, 1, 3, 2]. You can print any three of them in the answer.In the second sample there are only two sequences of tasks that meet the conditions — [3, 1, 2, 4, 5] and [3, 1, 4, 2, 5]. Consequently, it is impossible to make three distinct sequences of tasks.

// Generated by CoffeeScript 1.7.1
(function() {
  var buffer, console, process, readable, solve, source;

  solve = function(tasks) {
    var i, index, numWays, pass, sorted, value, virtualPass, x, _i, _j, _k, _l, _len, _len1, _len2, _m, _n, _ref;
    sorted = [];
    for (i = _i = 0; _i <= 2000; i = ++_i) {
      sorted[i] = [];
    }
    for (index = _j = 0, _len = tasks.length; _j < _len; index = ++_j) {
      value = tasks[index];
      sorted[value].push(index + 1);
    }
    numWays = 1;
    for (_k = 0, _len1 = sorted.length; _k < _len1; _k++) {
      x = sorted[_k];
      if (x.length >= 2) {
        numWays *= x.length;
      }
    }
    console.log((numWays >= 3 ? "YES" : "NO"));
    if (numWays >= 3) {
      for (pass = _l = 1; _l <= 3; pass = ++_l) {
        virtualPass = pass;
        for (_m = 0, _len2 = sorted.length; _m < _len2; _m++) {
          x = sorted[_m];
          if (x.length === 1) {
            process.stdout.write("" + x[0] + " ");
          }
          if (x.length === 2) {
            if (virtualPass === 1) {
              process.stdout.write("" + x[0] + " " + x[1] + " ");
            }
            if (virtualPass === 2) {
              process.stdout.write("" + x[1] + " " + x[0] + " ");
            }
            if (virtualPass === 3) {
              process.stdout.write("" + x[0] + " " + x[1] + " ");
              virtualPass = 2;
            }
          }
          if (x.length >= 3) {
            if (virtualPass === 1) {
              process.stdout.write("" + x[0] + " " + x[1] + " " + x[2] + " ");
            }
            if (virtualPass === 2) {
              process.stdout.write("" + x[1] + " " + x[2] + " " + x[0] + " ");
            }
            if (virtualPass === 3) {
              process.stdout.write("" + x[2] + " " + x[0] + " " + x[1] + " ");
            }
            if (x.length > 3) {
              for (i = _n = 3, _ref = x.length; 3 <= _ref ? _n < _ref : _n > _ref; i = 3 <= _ref ? ++_n : --_n) {
                process.stdout.write("" + x[i] + " ");
              }
            }
          }
        }
        console.log("");
      }
    }
    return console.log("");
  };

  if ((typeof process !== "undefined" && process !== null ? process.stdin : void 0) != null) {
    source = "";
    readable = process.stdin;
    readable.on('data', function(chunk) {
      return source += chunk;
    });
    readable.on('end', function() {
      var i, _i, _len, _results;
      source = source.split("\n\n");
      source = source.map(function(x) {
        return x.split("\n")[1];
      });
      source = source.map(function(x) {
        return x.split(/\s/g).map(function(z) {
          return parseInt(z, 10);
        });
      });
      _results = [];
      for (_i = 0, _len = source.length; _i < _len; _i++) {
        i = source[_i];
        _results.push(solve(i));
      }
      return _results;
    });
  } else {
    buffer = '';
    console = {};
    console.log = function(x) {
      print("" + buffer + x);
      return buffer = '';
    };
    process = {};
    process.stdout = {};
    process.stdout.write = function(x) {
      return buffer = "" + buffer + x;
    };
    source = readline();
    source = readline();
    source = source.split(/\s/g).map(function(z) {
      return parseInt(z, 10);
    });
    solve(source);
  }

}).call(this);

// Generated by CoffeeScript 1.7.1
(function() {
  var buffer, console, process, readable, solve, source;

  solve = function(tasks) {
    var i, index, numWays, pass, sorted, value, virtualPass, x, _i, _j, _k, _l, _len, _len1, _len2, _m;
    sorted = [];
    for (i = _i = 0; _i <= 2000; i = ++_i) {
      sorted[i] = [];
    }
    for (index = _j = 0, _len = tasks.length; _j < _len; index = ++_j) {
      value = tasks[index];
      sorted[value].push(index + 1);
    }
    numWays = 1;
    for (_k = 0, _len1 = sorted.length; _k < _len1; _k++) {
      x = sorted[_k];
      if (x.length >= 2) {
        numWays *= x.length;
      }
    }
    console.log((numWays >= 3 ? "YES" : "NO"));
    if (numWays >= 3) {
      for (pass = _l = 1; _l <= 3; pass = ++_l) {
        virtualPass = pass;
        for (_m = 0, _len2 = sorted.length; _m < _len2; _m++) {
          x = sorted[_m];
          if (x.length === 1) {
            process.stdout.write("" + x[0] + " ");
          }
          if (x.length === 2) {
            if (virtualPass === 1) {
              process.stdout.write("" + x[0] + " " + x[1] + " ");
            }
            if (virtualPass === 2) {
              process.stdout.write("" + x[1] + " " + x[0] + " ");
            }
            if (virtualPass === 3) {
              process.stdout.write("" + x[0] + " " + x[1] + " ");
              virtualPass = 2;
            }
          }
          if (x.length >= 3) {
            if (virtualPass === 1) {
              process.stdout.write("" + x[0] + " " + x[1] + " " + x[2] + " ");
            }
            if (virtualPass === 2) {
              process.stdout.write("" + x[1] + " " + x[2] + " " + x[0] + " ");
            }
            if (virtualPass === 3) {
              process.stdout.write("" + x[2] + " " + x[0] + " " + x[1] + " ");
            }
          }
        }
        console.log("");
      }
    }
    return console.log("");
  };

  if ((typeof process !== "undefined" && process !== null ? process.stdin : void 0) != null) {
    source = "";
    readable = process.stdin;
    readable.on('data', function(chunk) {
      return source += chunk;
    });
    readable.on('end', function() {
      var i, _i, _len, _results;
      source = source.split("\n\n");
      source = source.map(function(x) {
        return x.split("\n")[1];
      });
      source = source.map(function(x) {
        return x.split(/\s/g).map(function(z) {
          return parseInt(z, 10);
        });
      });
      _results = [];
      for (_i = 0, _len = source.length; _i < _len; _i++) {
        i = source[_i];
        _results.push(solve(i));
      }
      return _results;
    });
  } else {
    buffer = '';
    console = {};
    console.log = function(x) {
      print("" + buffer + x);
      return buffer = '';
    };
    process = {};
    process.stdout = {};
    process.stdout.write = function(x) {
      return buffer = "" + buffer + x;
    };
    source = readline();
    source = readline();
    source = source.split(/\s/g).map(function(z) {
      return parseInt(z, 10);
    });
    solve(source);
  }

}).call(this);

// Generated by CoffeeScript 1.7.1
(function() {
  var buffer, console, process, readable, solve, source;

  solve = function(tasks) {
    var i, index, numWays, pass, sorted, value, virtualPass, x, _i, _j, _k, _l, _len, _len1, _len2, _m;
    sorted = [];
    for (i = _i = 0; _i <= 2000; i = ++_i) {
      sorted[i] = [];
    }
    for (index = _j = 0, _len = tasks.length; _j < _len; index = ++_j) {
      value = tasks[index];
      sorted[value].push(index + 1);
    }
    numWays = 1;
    for (_k = 0, _len1 = sorted.length; _k < _len1; _k++) {
      x = sorted[_k];
      if (x.length >= 2) {
        numWays *= x.length;
      }
    }
    console.log((numWays >= 3 ? "YES" : "NO"));
    if (numWays >= 3) {
      for (pass = _l = 1; _l <= 3; pass = ++_l) {
        virtualPass = pass;
        for (_m = 0, _len2 = sorted.length; _m < _len2; _m++) {
          x = sorted[_m];
          if (x.length === 1) {
            process.stdout.write("" + x[0] + " ");
          }
          if (x.length === 2) {
            if (virtualPass === 1) {
              process.stdout.write("" + x[0] + " " + x[1] + " ");
            }
            if (virtualPass === 2) {
              process.stdout.write("" + x[1] + " " + x[0] + " ");
            }
            if (virtualPass === 3) {
              process.stdout.write("" + x[0] + " " + x[1] + " ");
              virtualPass = 2;
            }
          }
          if (x.length === 3) {
            if (virtualPass === 1) {
              process.stdout.write("" + x[0] + " " + x[1] + " " + x[2] + " ");
            }
            if (virtualPass === 2) {
              process.stdout.write("" + x[1] + " " + x[2] + " " + x[0] + " ");
            }
            if (virtualPass === 3) {
              process.stdout.write("" + x[2] + " " + x[0] + " " + x[1] + " ");
            }
          }
        }
        console.log("");
      }
    }
    return console.log("");
  };

  if (typeof process !== "undefined" && process !== null) {
    source = "";
    readable = process.stdin;
    readable.on('data', function(chunk) {
      return source += chunk;
    });
    readable.on('end', function() {
      var i, _i, _len, _results;
      source = source.split("\n\n");
      source = source.map(function(x) {
        return x.split("\n")[1];
      });
      source = source.map(function(x) {
        return x.split(/\s/g).map(function(z) {
          return parseInt(z, 10);
        });
      });
      _results = [];
      for (_i = 0, _len = source.length; _i < _len; _i++) {
        i = source[_i];
        _results.push(solve(i));
      }
      return _results;
    });
  } else {
    buffer = '';
    console = {};
    console.log = function(x) {
      print("" + buffer + x);
      return buffer = '';
    };
    process = {};
    process.stdout = {};
    process.stdout.write = function(x) {
      return buffer = "" + buffer + x;
    };
    source = readline();
    source = readline();
    source = source.split(/\s/g).map(function(z) {
      return parseInt(z, 10);
    });
    solve(source);
  }

}).call(this);

;(function () {

	print(function () {

		var qw = true;

		var n = +readline(),
			m = {}, lib = [],
			h = readline().split(' ').map(function (e, i) {
				e = +e;
				m[e] = m[e] ? m[e] + 1 : 1;
				if (lib.indexOf(e) === -1) lib.push(e);
				return [e, i+1];
			});

		h = h.sort(function (a, b) { return a[0] - b[0]; });

		var flag = false;
		lib.forEach(function (e) {
			if (m[e] === 1) flag = true;
		});

		if (flag) return 'NO';

		var ret = [[], [], []];

		lib = [];
		h.forEach(function (e) {
			if (lib.indexOf(e[0]) === -1) lib.push(e[0]);
		});

		lib.forEach(function (e) {
			var a = [];
			h.forEach(function (j) {
				if (j[0] === e) a.push(j[1]);
			});

			if (a.length === 2) {
				qw = !qw;
				if (qw) {
					ret[0].push(a[0], a[1]);
					ret[1].push(a[0], a[1]);
					ret[2].push(a[1], a[0]);
				} else {
					ret[0].push(a[0], a[1]);
					ret[1].push(a[1], a[0]);
					ret[2].push(a[1], a[0]);
				}
			} else {
				for (var j = 0; j < 3; j++)
					for (var i = j; i < a.length; i++) ret[j].push(a[i]);
				ret[1].push(a[0]);
				ret[2].push(a[0], a[1]);
			}
		});

		var n = 3;
		while (n--) {
			ret[n] = ret[n].join(' ');
		}

		ret.unshift('YES');

		return ret.join('\n');

	}());

}.call(this));

;(function () {

	print(function () {

		var qw = -1;

		var n = +readline(),
			m = {}, lib = [],
			h = readline().split(' ').map(function (e, i) {
				e = +e;
				m[e] = m[e] ? m[e] + 1 : 1;
				if (lib.indexOf(e) === -1) lib.push(e);
				return [e, i+1];
			});

		h = h.sort(function (a, b) { return a[0] - b[0]; });

		var flag = 0;
		lib.forEach(function (e) {
			if (m[e] == 2) flag++;
			if (m[e] == 3) flag+=3;
		});

		if (flag < 2 ) return 'NO';

		var ret = [[], [], []];

		lib = [];
		h.forEach(function (e) {
			if (lib.indexOf(e[0]) === -1) lib.push(e[0]);
		});

		lib.forEach(function (e) {
			var a = [];
			h.forEach(function (j) {
				if (j[0] === e) a.push(j[1]);
			});

			if (a.length === 2) {
				qw++;

				switch (qw % 3) {
					case 0:
						ret[0].push(a[0], a[1]);
						ret[1].push(a[0], a[1]);
						ret[2].push(a[1], a[0]);
						break;
					case 1:
						ret[0].push(a[0], a[1]);
						ret[1].push(a[1], a[0]);
						ret[2].push(a[0], a[1]);
						break;
					case 2:
						ret[0].push(a[1], a[0]);
						ret[1].push(a[0], a[1]);
						ret[2].push(a[0], a[1]);
						break;
				}
			} else {
				for (var j = 0; j < 3; j++)
					for (var i = j; i < a.length; i++) ret[j].push(a[i]);
				ret[1].push(a[0]);
				ret[2].push(a[0], a[1]);
			}
		});

		var n = 3;
		while (n--) {
			ret[n] = ret[n].join(' ');
		}

		ret.unshift('YES');

		return ret.join('\n');

	}());

}.call(this));

;(function () {

	print(function () {

		var qw = -1;

		var n = +readline(),
			m = {}, lib = [],
			h = readline().split(' ').map(function (e, i) {
				e = +e;
				m[e] = m[e] ? m[e] + 1 : 1;
				if (lib.indexOf(e) === -1) lib.push(e);
				return [e, i+1];
			});

		h = h.sort(function (a, b) { return a[0] - b[0]; });

		var flag = false;
		lib.forEach(function (e) {
			if (m[e] === 1) flag = true;
		});

		if (flag) return 'NO';

		var ret = [[], [], []];

		lib = [];
		h.forEach(function (e) {
			if (lib.indexOf(e[0]) === -1) lib.push(e[0]);
		});

		lib.forEach(function (e) {
			var a = [];
			h.forEach(function (j) {
				if (j[0] === e) a.push(j[1]);
			});

			if (a.length === 2) {
				qw++;

				switch (qw % 3) {
					case 0:
						ret[0].push(a[0], a[1]);
						ret[1].push(a[0], a[1]);
						ret[2].push(a[1], a[0]);
						break;
					case 1:
						ret[0].push(a[0], a[1]);
						ret[1].push(a[1], a[0]);
						ret[2].push(a[0], a[1]);
						break;
					case 2:
						ret[0].push(a[1], a[0]);
						ret[1].push(a[0], a[1]);
						ret[2].push(a[0], a[1]);
						break;
				}
			} else {
				for (var j = 0; j < 3; j++)
					for (var i = j; i < a.length; i++) ret[j].push(a[i]);
				ret[1].push(a[0]);
				ret[2].push(a[0], a[1]);
			}
		});

		var n = 3;
		while (n--) {
			ret[n] = ret[n].join(' ');
		}

		ret.unshift('YES');

		return ret.join('\n');

	}());

}.call(this));

;(function () {

	print(function () {

		var n = +readline(),
			m = {}, lib = [],
			h = readline().split(' ').map(function (e, i) {
				e = +e;
				m[e] = m[e] ? m[e] + 1 : 1;
				if (lib.indexOf(e) === -1) lib.push(e);
				return [e, i+1];
			});

		h = h.sort(function (a, b) { return a[0] - b[0]; });

		var flag = false;
		lib.forEach(function (e) {
			if (m[e] === 1) flag = true;
		});

		if (flag) return 'NO';

		var ret = [[], [], []];

		lib = [];
		h.forEach(function (e) {
			if (lib.indexOf(e[0]) === -1) lib.push(e[0]);
		});

		lib.forEach(function (e) {
			var a = [];
			h.forEach(function (j) {
				if (j[0] === e) a.push(j[1]);
			});

			if (a.length === 2) {
				ret[0].push(a[0], a[1]);
				ret[1].push(a[0], a[1]);
				ret[2].push(a[1], a[0]);
			} else {
				for (var i = 0; i < a.length; i++) ret[0].push(a[i]);
				for (var i = 1; i < a.length; i++) ret[1].push(a[i]); ret[1].push(a[0]);
				for (var i = 2; i < a.length; i++) ret[2].push(a[i]); ret[2].push(a[0], a[1]);
			}
		});

		var n = 3;
		while (n--) {
			ret[n] = ret[n].join(' ');
		}

		ret.unshift('YES');

		return ret.join('\n');

	}());

}.call(this));


I wonder, does the falling rain Forever yearn for it's disdain?Effluvium of the MindYou are given a positive integer $$$n$$$.Find any permutation $$$p$$$ of length $$$n$$$ such that the sum $$$\operatorname{lcm}(1,p_1) + \operatorname{lcm}(2, p_2) + \ldots + \operatorname{lcm}(n, p_n)$$$ is as large as possible. Here $$$\operatorname{lcm}(x, y)$$$ denotes the least common multiple (LCM) of integers $$$x$$$ and $$$y$$$.A permutation is an array consisting of $$$n$$$ distinct integers from $$$1$$$ to $$$n$$$ in arbitrary order. For example, $$$[2,3,1,5,4]$$$ is a permutation, but $$$[1,2,2]$$$ is not a permutation ($$$2$$$ appears twice in the array) and $$$[1,3,4]$$$ is also not a permutation ($$$n=3$$$ but there is $$$4$$$ in the array).

Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 1\,000$$$). Description of the test cases follows. The only line for each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$). It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case print $$$n$$$ integers $$$p_1$$$, $$$p_2$$$, $$$\ldots$$$, $$$p_n$$$ — the permutation with the maximum possible value of $$$\operatorname{lcm}(1,p_1) + \operatorname{lcm}(2, p_2) + \ldots + \operatorname{lcm}(n, p_n)$$$. If there are multiple answers, print any of them.

NoteFor $$$n = 1$$$, there is only one permutation, so the answer is $$$[1]$$$.For $$$n = 2$$$, there are two permutations:   $$$[1, 2]$$$ — the sum is $$$\operatorname{lcm}(1,1) + \operatorname{lcm}(2, 2) = 1 + 2 = 3$$$.  $$$[2, 1]$$$ — the sum is $$$\operatorname{lcm}(1,2) + \operatorname{lcm}(2, 1) = 2 + 2 = 4$$$.

var limit = parseInt(readline());
for (var i = 0; i < limit; i++)
{
    var value = parseInt(readline());
    var result = "";
    if (value % 2 === 0)
    {
        for (var j = 1; j <= value; j+=2)
        {
            result += `${j+1} ${j} `;
        }
    }
    else
    {
        result += "1 ";
        for (var j = 2; j <= value; j+=2)
        {
            result += `${j+1} ${j} `;
        }
    }
    print(result);
}

var tests = parseInt(readline());
    var n;
    for (var t=0; t < tests; t++) {
        n = parseInt(readline());
        var ans = [];
        var start = 1;
        if (n & 1) {
            start = 2;
            ans.push(1);
        }
        for (var i = start; i < n; i+=2) {
            ans.push(i+1);
            ans.push(i);
        }
        print(ans.join(' '));
    }

let ryan = '';//.map(Number).sort(function(a, b){return a - b})
process.stdin.on('data', c => ryan += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = ryan.split(EOL);
    var n = lines[0], e = 0, g = 0
    for(j = 1; j <= n; j++){
        var k = Number(lines[j])
        e = '', g = ''
        if(k % 2 == 1){
            e = '1' + ' '
            for(l = 1; l < k; l+=2){
                e += (l + 2) + ' ' + (l + 1) + ' '
            }
            console.log(e)
        }else{
            for(l = 2; l <= k; l+=2){
                e += (l) + ' ' + (l - 1) + ' '
            }
            console.log(e)
        }
    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var n = lines[i];
        var ans = '';
        if(n % 2 == 1){
            var a = 1;
            for(j = 0; j < n; j++){
                ans += a + ' ';
                if(j === 0){
                    a += 2;
                }else if(j % 2 == 1){
                    a--;
                }else if(j % 2 === 0){
                    a += 3;
                }
            }
        }else{
            var b = 2;
            for(j = 0; j < n; j++){
                ans += b + ' ';
                if(j % 2 === 0){
                    b--;
                }else if(j % 2 == 1){
                    b += 3;
                }
            }
        }
        console.log(ans);
    }
});

process.stdin.resume();
process.stdin.setEncoding("ascii");

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

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

process.stdin.on("end", function () {
  input_stdin_array = input_stdin.split("\n");
  // console.log(input_stdin_array);
  main();
});

function readLine() {
  return input_stdin_array[input_currentline++];
}

function main() {
  var a = readLine();
  while (a--) {
    var b = readLine();
    var res = solveMeFirst(b);
    let out = "";
    if (res) {
      for (let i = 0; i < res.length; i++) {
        out += res[i] + " ";
      }
      console.log(out);
    }
  }
}
function solveMeFirst(p) {
  let arr = [];
  if (p % 2 === 0) {
    arr.push(2);
  } else if (p > 1) {
    arr.push(1);
    arr.push(3);
  } else {
    arr.push(1);
  }
  let isMinus = true;
  for (let i = p % 2 === 0 ? 1 : 2; i < p; i++) {
    if (isMinus) {
      arr[i] = arr[i - 1] - 1;
      isMinus = false;
    } else {
      arr[i] = arr[i - 1] + 3;
      isMinus = true;
    }
  }
  return arr;
}

// console.log(solveMeFirst(2, [2, 3, 2, 4, 1, 3, 4, 1]));
// console.log(timeConversion([100, 90, 90, 80], [70, 80, 105]));

'use strict';

const fs = require('fs');

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function isPossible(n, x, heights) {
    heights.sort();
    heights.sort(function(a, b) {
        return a - b;
      });
    // //console.log(heights)

    let front = []
    let back = []

    for (let i = 0; i < heights.length; i++) {
        if (i < n) {
            front.push(heights[i])
        } else {
            back.push(heights[i])
        }
    }

    // //console.log(front)
    // //console.log(back)
    for (let j = 0; j < front.length; j++) {
        if (back[j] - front[j] < x) {
            // //console.log(back[j] + " " + front[j])
            return "NO";
        }
    }

    return "YES";
}

function calc(a, m) {
    let s = "";
    for (let index = 0; index < m; index++) {
        s += "B"
    }

   for (let index = 0; index < a.length; index++) {
        let ai = a[index];

        if (ai < (m + 1 - ai)) {
            let _s = s.replaceAt(ai - 1, "A");
            if (compare(_s, s) < 0) {
                s = _s;
                continue;
            } else if (compare(_s, s) >= 0) {
                    let __ss = s.replaceAt(m + 1 - ai - 1, "A");
                    if (compare(__ss, s) < 0) {
                        s = __ss;
                        continue;
                    }
            }
         }  else {
            let _s = s.replaceAt(m + 1 - ai - 1, "A");
            if (compare(_s, s) < 0) {
                s = _s;
                continue;
            }  if (compare(_s, s) >= 0) {
                    let __ss = s.replaceAt(ai - 1, "A");
                    if (compare(__ss, s) < 0) {
                        s = __ss;
                        continue;
                    }
            }
    }
}

   return s;
}

function compare(s1, s2) {
    return s1.localeCompare(s2)
}

String.prototype.replaceAt = function(index, replacement) {
    return this.substring(0, index) + replacement + this.substring(index + replacement.length);
}

function main() {
    // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const test_cases = parseInt(readLine().trim(), 10);

    for (let gItr = 0; gItr < test_cases; gItr++) {
        // const nk = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        // const n = nk[0];
        // const k = nk[1];

        const n = parseInt(readLine().trim(), 10);
        let a = []

        if (n%2 == 0) {
            for (let i = n; i > 0; i-=2) {
                a.push(i - 1)
                a.push(i)
            }
        } else {
            for (let i = n; i > 1; i-=2) {
                a.push(i - 1)
                a.push(i)
            }
            a.push(1)
        }

        a = a.reverse()
        // console.log(a)
        let s = ""
        for (let i = 0; i < a.length; i++) {
            // console.log(a[i])
            s += a[i] + " "
        }

        s.slice(0, -1);
        console.log(s)

        // const p = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        // const q = p
        // if (k == n || k == 0) {
        //     console.log("0");
        // } else {
        //     const p1 = p.slice(0, k)
        //     q.sort(function(a, b){return a-b});

        //     let count = 0
        //     for (let i = 0; i < k; i++) {
        //         if (!p1.includes(q[i])) count++
        //     }

        //     console.log(count)
        // }

        // if ((n >= 1 && n <= 50) && (m >= 1 && m <= 50)) {
        // const val = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        // const val = readLine().trim()
        // if (val.toUpperCase() == "YES") console.log("YES")
        // else console.log("NO")
        // let output = calc(val, m);
        // console.log(output)
        // }
        // ws.write(result + '\n');
    }

    // ws.end();
}

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

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		var list = [];
		for(var i = 1; i <= N; i++){
			list.push(i);
		}
		for(var i = N - 1; i > 0; i -= 2){
			var tmp = list[i - 1];
			list[i - 1] = list[i];
			list[i] = tmp;
		}
		myout(myconv(list, 8));
	}
}

const fs = require("fs");
const input = fs.readFileSync(0, 'utf8').trim().split('\r\n');
let currentline = 0;
function readline(){
      return input[currentline++];
}

function alph() {
  var f = 'abcdefghijklmnopqrstuvwxyz';
  return f;
}
function Alph() {
  var f = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  return f;
}
function max(x,y) {
  return x >=y ? x : y;
}
function min(x,y) {
  return x <=y ? x : y;
}
function abs(x) {
  return x < 0 ? x*(-1) : x;
}

var T = readline();
var inf = 1000000000000;
for(var tc=1;tc<=T;tc++) {
  // var [n, k] = readline().split(' ').map((x) => parseInt(x));
  // var a = readline().split(' ').map((x) => parseInt(x));
  var n = readline();
  var a = [];
  if(n % 2 == 0) {
    for(var i=0;i<n;i+=2) {
      a[i] = i+2;
      a[i+1] = i+1
    }
  } else {
    a[0] = 1;
    for(var i=1;i+1<n;i+=2) {
      a[i] = i+2;
      a[i+1] = i+1
    }
  }

  console.log(a.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++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let i = 0; i < N; i++) {
        const n = parseInt(readline(), 10);

        let result = [];
        let i = 0;
        if (n % 2 === 0) {
            result.push(2);
            result.push(1);
            i = 3;
            for (; i <= n; i++) {
                i % 2 === 0 ? result.push(i - 1) : result.push(i + 1);
            }
        } else {
            result.push(1);
            i = 2;
            for (; i <= n; i++) {
                i % 2 === 0 ? result.push(i + 1) : result.push(i - 1);
            }
        }

        output(result.join(' '));
    }
}

'use strict';

function solve(n) {
  const res = new Array(n);
  for (let i = n - 1; i >= 0; i -= 2) {
    if (i === 0) {
      res[i] = 1;
    } else {
      res[i] = i;
      res[i - 1] = i + 1;
    }
  }
  return res.join(' ');
}

async function main(r) {
  const rn = async () => Number(await r());
  try {
    let t = Number(await r());
    let res = new Array(t);
    for (let i = 0; i < t; i++) {
      const n = await rn();
      res[i] = solve(n);
    }
    return res.join('\n');
  } catch (error) {
    console.log(error);
  }
}

let inputs,
    str = '';
function read() {
  return inputs.next().value.trim();
}
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', input => str += input);
process.stdin.on('end', async () => {
  inputs = str.split('\n').values();
  const output = await main(read);
  process.stdout.write(output);
});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0]
    var a = 0
    for(j = 1; j <= n ;j ++){
    var k = lines[j]
        a = k + ' '
        for(l = 1; l < k; l++){
            a += l + ' '
        }
            console.log(a)

    }

});

let i = '';
process.stdin.on('data', c => i += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = i.split(EOL);
    var n = lines[0]
    for(j = 1; j <= n; j++){
        var f = false
        var h = lines[j].split('')
        var r = lines[j].split('')
        h.reverse()
        console.log(h, r)
        if(h == r){
            for(l = 0 ; l < h.length; l++){
                if(h[l] == h[l + 1]){
                    f = true
                }else{
                    f = false
                    h.splice(0, 0,  h[1], h[0])
                    h.splice(2, 2)
                    break;
                }
            }
            if(f === true){
                console.log(-1)
            }else{
                console.log(h)
            }
        }else{
            console.log(lines[j], 'dasd')
        }

    }
});

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var n = lines[0];
    for(i = 1; i <= n; i++){
        var t = lines[i];

    }
    console.log(1);
    console.log(2, 1);
});

process.stdin.resume();
process.stdin.setEncoding("ascii");

var input_stdin = "";
var input_stdin_array = "";
var input_currentline = 0;

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

process.stdin.on("end", function () {
  input_stdin_array = input_stdin.split("\n");
  // console.log(input_stdin_array);
  main();
});

function readLine() {
  return input_stdin_array[input_currentline++];
}

function main() {
  var a = readLine();
  while (a--) {
    var b = readLine();
    var res = solveMeFirst(b);
    let out = "";
    if (res) {
      for (let i = 0; i < res.length; i++) {
        out += res[i] + " ";
      }
      console.log(out);
    }
  }
}
function solveMeFirst(p) {
  let arr = [];
  for (let i = +p; i >= 1; i--) {
    arr.push(i);
  }
  return arr;
}

// console.log(solveMeFirst(2, [2, 3, 2, 4, 1, 3, 4, 1]));
// console.log(timeConversion([100, 90, 90, 80], [70, 80, 105]));

'use strict';

const fs = require('fs');

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

let inputString = '';
let currentLine = 0;

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

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

    main();
});

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

function isPossible(n, x, heights) {
    heights.sort();
    heights.sort(function(a, b) {
        return a - b;
      });
    // //console.log(heights)

    let front = []
    let back = []

    for (let i = 0; i < heights.length; i++) {
        if (i < n) {
            front.push(heights[i])
        } else {
            back.push(heights[i])
        }
    }

    // //console.log(front)
    // //console.log(back)
    for (let j = 0; j < front.length; j++) {
        if (back[j] - front[j] < x) {
            // //console.log(back[j] + " " + front[j])
            return "NO";
        }
    }

    return "YES";
}

function calc(a, m) {
    let s = "";
    for (let index = 0; index < m; index++) {
        s += "B"
    }

   for (let index = 0; index < a.length; index++) {
        let ai = a[index];

        if (ai < (m + 1 - ai)) {
            let _s = s.replaceAt(ai - 1, "A");
            if (compare(_s, s) < 0) {
                s = _s;
                continue;
            } else if (compare(_s, s) >= 0) {
                    let __ss = s.replaceAt(m + 1 - ai - 1, "A");
                    if (compare(__ss, s) < 0) {
                        s = __ss;
                        continue;
                    }
            }
         }  else {
            let _s = s.replaceAt(m + 1 - ai - 1, "A");
            if (compare(_s, s) < 0) {
                s = _s;
                continue;
            }  if (compare(_s, s) >= 0) {
                    let __ss = s.replaceAt(ai - 1, "A");
                    if (compare(__ss, s) < 0) {
                        s = __ss;
                        continue;
                    }
            }
    }
}

   return s;
}

function compare(s1, s2) {
    return s1.localeCompare(s2)
}

String.prototype.replaceAt = function(index, replacement) {
    return this.substring(0, index) + replacement + this.substring(index + replacement.length);
}

function main() {
    // const ws = fs.createWriteStream(process.env.OUTPUT_PATH);

    const test_cases = parseInt(readLine().trim(), 10);

    for (let gItr = 0; gItr < test_cases; gItr++) {
        // const nk = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        // const n = nk[0];
        // const k = nk[1];

        const n = parseInt(readLine().trim(), 10);
        let a = []

        for (let i = n; i > 0; i --) {
            a.push(i)
        }

        let s = ""
        for (let i = 0; i < a.length; i++) {
            // console.log(a[i])
            s += a[i] + " "
        }

        s.slice(0, -1);
        console.log(s)

        // const p = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        // const q = p
        // if (k == n || k == 0) {
        //     console.log("0");
        // } else {
        //     const p1 = p.slice(0, k)
        //     q.sort(function(a, b){return a-b});

        //     let count = 0
        //     for (let i = 0; i < k; i++) {
        //         if (!p1.includes(q[i])) count++
        //     }

        //     console.log(count)
        // }

        // if ((n >= 1 && n <= 50) && (m >= 1 && m <= 50)) {
        // const val = readLine().replace(/\s+$/g, '').split(' ').map(arrTemp => parseInt(arrTemp, 10));
        // const val = readLine().trim()
        // if (val.toUpperCase() == "YES") console.log("YES")
        // else console.log("NO")
        // let output = calc(val, m);
        // console.log(output)
        // }
        // ws.write(result + '\n');
    }

    // ws.end();
}


Arkady coordinates rounds on some not really famous competitive programming platform. Each round features $$$n$$$ problems of distinct difficulty, the difficulties are numbered from $$$1$$$ to $$$n$$$.To hold a round Arkady needs $$$n$$$ new (not used previously) problems, one for each difficulty. As for now, Arkady creates all the problems himself, but unfortunately, he can't just create a problem of a desired difficulty. Instead, when he creates a problem, he evaluates its difficulty from $$$1$$$ to $$$n$$$ and puts it into the problems pool.At each moment when Arkady can choose a set of $$$n$$$ new problems of distinct difficulties from the pool, he holds a round with these problems and removes them from the pool. Arkady always creates one problem at a time, so if he can hold a round after creating a problem, he immediately does it.You are given a sequence of problems' difficulties in the order Arkady created them. For each problem, determine whether Arkady held the round right after creating this problem, or not. Initially the problems pool is empty.

The first line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 10^5$$$) — the number of difficulty levels and the number of problems Arkady created. The second line contains $$$m$$$ integers $$$a_1, a_2, \ldots, a_m$$$ ($$$1 \le a_i \le n$$$) — the problems' difficulties in the order Arkady created them.

Print a line containing $$$m$$$ digits. The $$$i$$$-th digit should be $$$1$$$ if Arkady held the round after creation of the $$$i$$$-th problem, and $$$0$$$ otherwise.

NoteIn the first example Arkady held the round after the first three problems, because they are of distinct difficulties, and then only after the last problem.

function calc(n, m, a) {
  var dict = {};
  var count = 0;
  var res = "";

  a.map(elem => {
    if (dict[elem]) {
      dict[elem]++;
      res += "0";
    } else {
      count++;
      dict[elem] = 1;

      if (count === n) {
        res += "1";
        Object.keys(dict).map(key => {
          dict[key]--;
        });
        count = Object.keys(dict).filter(key => {
          return dict[key] > 0;
        }).length;
      } else {
        res += "0";
      }
    }
  })

  return res;
}

var nm = readline().split(" ");
var n = parseInt(nm[0]);
var m = parseInt(nm[1]);
var a = readline().split(" ");

print(calc(n, m, a));

function calc(n, m, a) {
  var dict = {};
  var count = 0;
  var res = "";

  a.map(elem => {
    if (dict[elem]) {
      dict[elem]++;
      res += "0";
    } else {
      count++;
      dict[elem] = 1;

      if (count === n) {
        res += "1";
        count = 0;
        Object.keys(dict).map(key => {
          dict[key]--;
        })
      } else {
        res += "0";
      }
    }

//     console.log(dict);
  })

  return res;
}

var nm = readline().split(" ");
var n = parseInt(nm[0]);
var m = parseInt(nm[1]);
var a = readline().split(" ");

print(calc(n, m, a));

function calc(n, m, a) {
  var dict = {};
  var count = 0;
  var res = "";

  a.map(elem => {
    if (dict[elem]) {
      dict[elem]++;
      res += "0";
    } else {
      count++;
      dict[elem] = 1;

      if (count === n) {
        res += "1";
        count = Object.keys(dict).filter(key => {
          dict[key] > 0;
        }).length;
        Object.keys(dict).map(key => {
          dict[key]--;
        })
      } else {
        res += "0";
      }
    }

//     console.log(dict);
  })

  return res;
}

var nm = readline().split(" ");
var n = parseInt(nm[0]);
var m = parseInt(nm[1]);
var a = readline().split(" ");

print(calc(n, m, a));

function calc(n, m, a) {
  var dict = {};
  var count = 0;
  var res = "";

  a.map(elem => {
    if (dict[elem]) {
      dict[elem]++;
      res += "0";
    } else {
      count++;
      dict[elem] = 1;

      if (count === n) {
        res += "1";
        count = 0;
        Object.keys(dict).map(key => {
          dict[key]--;
        })
      } else {
        res += "0";
      }
    }

//     console.log(dict);
  })

  return res;
}

var nm = readline().split(" ");
var n = parseInt(nm[0]);
var m = parseInt(nm[1]);
var a = readline().split(" ").map(elem => parseInt(elem));

print(calc(n, m, a));


Today, hedgehog Filya went to school for the very first time! Teacher gave him a homework which Filya was unable to complete without your help.Filya is given an array of non-negative integers a1, a2, ..., an. First, he pick an integer x and then he adds x to some elements of the array (no more than once), subtract x from some other elements (also, no more than once) and do no change other elements. He wants all elements of the array to be equal.Now he wonders if it's possible to pick such integer x and change some elements of the array using this x in order to make all elements equal.

The first line of the input contains an integer n (1 ≤ n ≤ 100 000) — the number of integers in the Filya's array. The second line contains n integers a1, a2, ..., an (0 ≤ ai ≤ 109) — elements of the array.

If it's impossible to make all elements of the array equal using the process given in the problem statement, then print "NO" (without quotes) in the only line of the output. Otherwise print "YES" (without quotes).

NoteIn the first sample Filya should select x = 1, then add it to the first and the last elements of the array and subtract from the second and the third elements.

function readIntTabLine(n) {
  var l = readline().split(' ')
  for (var i = 0 ; i < n ; i++) {
    l[i] = parseInt(l[i])
  }
  return l
}

var n = parseInt(readline())
var tab = readIntTabLine(n)
var possible = true
var set = []

for (var i = 0 ; i < n && possible; i++) {
  if (set.indexOf(tab[i]) == -1)
    possible = set.push(tab[i]) <= 3
}

if (!possible) print('NO')
else if (set.length < 3) print('YES')
else {
  var tri = []
  tri.push(Math.min.apply(null, set))
  set.splice(set.indexOf(tri[0]),1)
  tri.push(Math.min(set[0],set[1]))
  tri.push(Math.max(set[0],set[1]))
  if (tri[1]-tri[0] == tri[2]-tri[1]) print('YES')
  else print('NO')
}

readline();
var a = readline().split( " " ).map( ai => parseInt( ai, 10 ) );
var values = [...new Set( a )];
var answer = "NO";
// min + x = mid = max - x can't be equal to some other number.
if ( values.length == 3 ) {
  values.sort( ( a, b ) => a - b );
  var min = values[ 0 ];
  var mid = values[ 1 ];
  var max = values[ 2 ];
  var x = ( max - min ) / 2;
  if ( Math.floor( x ) == x && min + x == mid && mid == max - x ) {
    answer = "YES";
  }
} else if ( values.length < 3 ) {
  answer = "YES";
}
print( answer );

readline();
var a = readline().split( " " ).map( ai => parseInt( ai, 10 ) );
var values = [...new Set( a )];
var answer = "NO";
// min + x = mid = max - x are only possible combinations of x and some number.
if ( values.length == 3 ) {
  values.sort( ( a, b ) => a - b );
  var min = values[ 0 ];
  var mid = values[ 1 ];
  var max = values[ 2 ];
  // Derived from equation above.
  if ( 2 * mid == max + min ) {
    answer = "YES";
  }
} else if ( values.length < 3 ) {
  answer = "YES";
}
print( answer );


You're given an array $$$a$$$ of length $$$n$$$. You can perform the following operation on it as many times as you want:  Pick two integers $$$i$$$ and $$$j$$$ $$$(1 \le i,j \le n)$$$ such that $$$a_i+a_j$$$ is odd, then swap $$$a_i$$$ and $$$a_j$$$. What is lexicographically the smallest array you can obtain?An array $$$x$$$ is lexicographically smaller than an array $$$y$$$ if there exists an index $$$i$$$ such that $$$x_i<y_i$$$, and $$$x_j=y_j$$$ for all $$$1 \le j < i$$$. Less formally, at the first index $$$i$$$ in which they differ, $$$x_i<y_i$$$

The first line contains an integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of elements in the array $$$a$$$. The second line contains $$$n$$$ space-separated integers $$$a_1$$$, $$$a_2$$$, $$$\ldots$$$, $$$a_{n}$$$ ($$$1 \le a_i \le 10^9$$$) — the elements of the array $$$a$$$.

The only line contains $$$n$$$ space-separated integers, the lexicographically smallest array you can obtain.

NoteIn the first example, we can swap $$$1$$$ and $$$4$$$ since $$$1+4=5$$$, which is odd.

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ');

    var c = false;
    var nc = false;
    for(var i = 0; i < n; i++) {
        if(a[i] % 2) {
            c = true;
        }
        else {
            nc = true;
        }
    }

    if(c && nc) {
        print(a.sort((a, b) => a - b).join(' '));
    }
    else {
        print(a.join(' '));
    }
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ').sort((a, b) => {
        if((a + b) % 2)
            return a - b;
        else return 0;
    });
    print(a.join(' '));
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ');

    var res = '';
    for(var i = 1; i < n; i++) {
        if(a[i] < a[i - 1]) {
            var tmp = a[i];
            a[i] = a[i - 1];
            a[i - 1] = tmp;
            print(a.join(' '));
            return;
        }
    }

    print(a.join(' '));
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ').sort((a, b) => a - b);
    print(a.join(' '));
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ');

    var res = '';
    for(var i = 1; i < n; i++) {
        if((a[i] + a[i - 1]) % 2 && a[i] < a[i - 1]) {
            var tmp = a[i];
            a[i] = a[i - 1];
            a[i - 1] = tmp;
            print(a.join(' '));
            return;
        }
    }

    print(a.join(' '));
}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ');

    var c = false;
    var n = false;
    for(var i = 0; i < n; i++) {
        if(a[i] % 2) {
            c = true;
        }
        else {
            n = true;
        }
    }

    if(c && n) {
        print(a.sort((a, b) => a - b).join(' '));
    }
    else {
        print(a.join(' '));
    }

}());

(function () {
    var read = {
        number: function () {
            return +readline();
        },
        arr: function (divider) {
            return readline().split(divider ? divider : '');
        },
        arrNumber: function (divider) {
            return readline()
                .split(divider ? divider : '')
                .map(item => +item);
        }
    };

    var n = read.number();
    var a = read.arrNumber(' ');

    var res = '';
    for(var i = 0; i < n; i++) {
        for(var j = i + 1; j < n; j++) {
            if((a[i] + a[j]) % 2 && a[i] > a[j]) {
                var tmp = a[i];
                a[i] = a[j];
                a[j] = tmp;
                print(a.join(' '));
                return;
            }
        }
    }

    print(a.join(' '));
}());


As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx configuration for school's website. The school has n servers. Each server has a name and an ip (names aren't necessarily unique, but ips are). Dustin knows the ip and name of each server. For simplicity, we'll assume that an nginx command is of form "command ip;" where command is a string consisting of English lowercase letter only, and ip is the ip of one of school servers.  Each ip is of form "a.b.c.d" where a, b, c and d are non-negative integers less than or equal to 255 (with no leading zeros). The nginx configuration file Dustin has to add comments to has m commands. Nobody ever memorizes the ips of servers, so to understand the configuration better, Dustin has to comment the name of server that the ip belongs to at the end of each line (after each command). More formally, if a line is "command ip;" Dustin has to replace it with "command ip; #name" where name is the name of the server with ip equal to ip.Dustin doesn't know anything about nginx, so he panicked again and his friends asked you to do his task for him.

The first line of input contains two integers n and m (1 ≤ n, m ≤ 1000). The next n lines contain the names and ips of the servers. Each line contains a string name, name of the server and a string ip, ip of the server, separated by space (1 ≤ |name| ≤ 10, name only consists of English lowercase letters). It is guaranteed that all ip are distinct. The next m lines contain the commands in the configuration file. Each line is of form "command ip;" (1 ≤ |command| ≤ 10, command only consists of English lowercase letters). It is guaranteed that ip belongs to one of the n school servers.

Print m lines, the commands in the configuration file after Dustin did his task.

'use strict';

let line = readline().split(' ');
let n = parseInt(line[0]);
let m = parseInt(line[1]);
const container = {};
let command, ip;
while (n--) {
  line = readline().split(' ');
  command = line[0];
  ip = line[1];
  container[ip] = command;
}

while (m--) {
  line = readline().split(' ');
  command = line[0];
  ip = line[1].substr(0, line[1].length - 1);
  print (command + ' ' + ip + '; #' + container[ip]);
}

'use strict';

let line = readline().split(' ');
let n = parseInt(line[0]);
let m = parseInt(line[1]);
const container = {};
let command, ip;
while (n--) {
  line = readline().split(' ');
  command = line[0];
  ip = line[1];
  container[ip] = command;
}

while (m--) {
  line = readline().split(' ');
  command = line[0];
  ip = line[1].substr(0, line[1].length - 1);
  print (`${command} ${ip}; #${container[ip]}`);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var an=new Array(n);
var am=new Array(m);
for(var i=0;i<n;i++){
	an[i]=readline();
}
for(var i=0;i<m;i++){
	am[i]=readline();
}
var f1="",f2="";
for(var i=0;i<m;i++){
	f1=am[i].split(" ");
	for(var y=0;y<n;y++){
		f2=(an[y].concat(";")).split(" ");
		if(f1[1]===f2[1]){print(f1[0].concat(" ",f1[1]," #",f2[0]));}
	}
}

var line = readline();
var n = line.split(" ")[0];
var m = line.split(" ")[1];
var domains = {};
var ip, server;

for(var i = 0; i < n; i++){
    line = readline();
    ip = line.split(" ")[1];
    server = line.split(" ")[0];
    domains[ip] = server;
}

for(var i = 0; i < m; i++){
    line = readline();
    ip = line.split(" ")[1].slice(0, -1);
    print(line + " #" + domains[ip]);
}

var serversAndCommandsAmount = readline().split(' ').map(Number);

var s = serversAndCommandsAmount[0],
    c = serversAndCommandsAmount[1];

var servers = {}

for (var i = 0; i < s; i++) {
  var server = readline().split(' ');
  servers[ server[1] ] = server[0];
}

for (var i = 0; i < c; i++) {
  var command = readline();
  print(command + ' #' + servers[ command.split(' ')[1].slice(0, -1)]);
}

var operations = readline().split(" ");
var servers=[], options=[];
for (var i = 0; i < operations[0]; i++) {
    servers.push(readline());
}
for (var j = 0; j < operations[1]; j++) {
    options.push(readline());
}
for (var option = 0; option < options.length; option++) {
    var strWithIp = options[option].split(" ")[1];
    var ip = strWithIp.substring(0,strWithIp.length-1);
    for (var server = 0; server < servers.length; server++) {
        var strWithServerIp = servers[server].split(" ")[1];
        if (strWithServerIp == ip) {
            write(options[option] + " #" + servers[server].split(" ")[0] + "\n");
            break;
        }
    }
}

function main() {
  var nm = readline().split(' ');
  var n = nm[0];
  var m = nm[1];
  var ipNames = [];
  var result = [];

  for (var i = 0; i < n; i++) {
    var nameIp = readline().split(' ');
    var name = nameIp[0];
    var ip = nameIp[1];
    ipNames.push({ name: name, ip: ip });
  }

  for (var i = 0; i < m; i++) {
    var line = readline();
    var ip = line.split(' ')[1].slice(0, -1);
    var item = ipNames.find(item => item.ip === ip);
    result.push(line + ' #' + item.name);
  }

  for (var i = 0; i < m; i++) {
    print(result[i]);
  }
}

main();

var a = readline().split(" ");
var n = parseInt(a[0]);
var m = parseInt(a[1]);

var nameArr = [];
var ipArr = [];
var funcArr = [];

for(var i = 0; i < n; i++)
{
    var nInput = readline().split(" ");
    var name = nInput[0];
    var ip = nInput[1] + ";";

    nameArr.push(name);
    ipArr.push(ip);
}

for(var i = 0; i < m; i++)
{
    var mInput = readline().split(" ");
    var func = mInput[0];
    var ip = mInput[1];

    funcArr.push(ip);
    funcArr.push(func);
}

for(var i = 0; i < (2 * m); i += 2)
{
    var ip = funcArr[i];
    var func = funcArr[i + 1];

    for(var j = 0; j < n; j++)
    {
        if(ip == ipArr[j])
        {
            var name = nameArr[j];
            break;
        }
    }

    print(func + " " + ip + " #" + name);
}

var dim = readline().split(' ');
var n = parseInt(dim[0]);
var m = parseInt(dim[1]);
var k, mydns = {};
for(k = 1; k <= n; k++){
	var server = readline().split(' ');
	mydns[server[1]] = server[0];
}

for(k = 0; k < m; k++){
	var command = readline().split(/[; ]/);
	print(command[0] + ' ' + command[1] + '; #' + mydns[command[1]]);
}

nm = readline().split(' ').map(Number);

var n = nm[0], m = nm[1], nameArr = [];

for (var i = 0; i < n; i++) {
	str = readline().split(' ');

	for (var j = 0; j < str.length; j++) {
		nameArr.push(str[j]);
	};
};

for (var j = 0; j < m; j++) {
	str = readline().split(' ');

	for (var k = 0; k < nameArr.length; k++) {
		if (nameArr[k] + ';' == str[1]) {
			print(str.join(' ') + ' #' + nameArr[k - 1]);
		};
	};
};

"use strict";

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

let [namesLength, commandsLenght] = [null];
let ips = [], names = [], commands = [];

readline.on('line', line => {
    if (!namesLength) {
        [namesLength, commandsLenght] = line.split(' ');
    } else if (names.length < namesLength) {
        let [a, b] = line.split(' ');
        names.push(a);
        ips.push(b);
    } else {
        commands.push(line.split(' '));
        if (commands.length == commandsLenght)
            readline.close();
    }
});

readline.on('close', () => {
    writeFile();
});

const writeFile = () => {
    commands.map(input => {
        let [name, target] = input;
        let origin = names[ips.indexOf(target.split(';')[0])];
        console.log(`${name} ${target} #${origin}`);
    })
};

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

rl.on('line', (d) => {
  if (c === 0) {
    [n, m] = d.split(' ').map(Number);

    c++;
    return;
  }

  if (c <= n) {
    const [name, ip] = d.split(' ');
    obj[`${ip};`] = `#${name}`;

    c++;
    return;
  }

  const [command, ip] = d.split(' ');
  console.log(`${command} ${ip} ${obj[ip]}`);

  c++;
});

rl.on('close', () => {

});

'use strict';

let line = readline().split(' ');
let n = parseInt(line[0]);
let m = parseInt(line[1]);
const container = {};
let command, ip;
while (n--) {
  line = readline().split(' ');
  command = line[0];
  ip = line[1];
  container[ip] = command;
}

while (m--) {
  line = readline().split(' ');
  command = line[0];
  ip = line[1].substr(0, ip.length - 1);
  print (command + ' ' + ip + '; #' + container[ip]);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var i2=0;
var full1="",full2="";
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){

	full1=ar[i].concat(";").split(" ");

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

	full2=ar[y].split(" ");
	if(full1[1]==full2[1]&&full1[0]!=full2[0]){ar2[i2]=(full2.concat(" #",full1[0]));i2++;}
}
}for(var i=0;i<m;i++){
	print(ar2[i]);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var an=new Array(n);
var am=new Array(m);
for(var i=0;i<n;i++){
	an[i]=readline();
}
for(var i=0;i<m;i++){
	am[i]=readline();
}
var f1="",f2="";
for(var i=0;i<m;i++){
	f1=am[i].split(" ");
	for(var y=0;y<n;y++){
		f2=(an[y].concat(";")).split(" ");
		if(f1[1]===f2[1]){print(f1[0].concat(f1[1]," #",f2[0]));}
	}
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var full1,full2;
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){
	full1=ar[i];
	full1=full1.concat(";");
	full1=full1.split(" ");

for(var y=i+1;y<n;y++){

	full2=ar[y].split(" ");
	if(full1[1]===full2[1]){print(full2.concat(" #",full1[0]));}
}
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var i2=0;
var full1="",full2="";
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){
for(var y=i+1;y<n;y++){
		full1=ar[i].split(" ");

	full2=ar[y].split(" ");
	if(full1[1].concat(";")===full2[1]){ar2[i2]=full2.concat(" #",full1[0]);i2++;}
}
}for(var i=0;i<m;i++){
	print(ar2[i]);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var i2=0;
var full1="",full2="";
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){
	full1=ar[i].split(" ");
for(var y=i+1;y<n;y++){

	full2=ar[y].split(" ");
	if(full1[1]===full2[1]){ar2[i2]=full2.concat(" #",full1[0]);i2++;}
}
}for(var i=0;i<m;i++){
	print(ar2[i]);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var i2=0;
var full1="",full2="";
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){
for(var y=i+1;y<n;y++){
		full1=ar[i].split(" ");

	full2=ar[y].split(" ");
	if(full1[1]===full2[1]){ar2[i2]=full2.concat(" #",full1[0]);i2++;}
}
}for(var i=0;i<m;i++){
	print(ar2[i]);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var i2=0;
var full1,full2;
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){
	full1=ar[i];
	full1=full1.concat(";");
	full1=full1.split(" ");

for(var y=i+1;y<n;y++){

	full2=ar[y].split(" ");
	if(full1[1]===full2[1]){ar2[i2]=(full2.concat(" #",full1[0]));i2++;}
}
}for(var i=0;i<m;i++){
	print(ar2[i]);
}

var l=readline().split(" ");
var n=parseInt(l[0]);
var m=parseInt(l[1]);
var ar=new Array(n);
var i2=0;
var full1,full2;
var ar2=new Array(m);
for(var i=0;i<n;i++){
	ar[i]=readline();
}
for(var i=0;i<n;i++){
	full1=ar[i].split(" ");
for(var y=i+1;y<n;y++){

	full2=ar[y].split(" ");
	if(full1[1]===full2[1]){ar2[i2]=full2+" #"+full1[0];i2++;}
}
}for(var i=0;i<m;i++){
	print(ar2[i]);
}

function main() {
  var nm = readline().split(' ');
  var n = nm[0];
  var m = nm[1];
  var ipNames = [];
  var result = [];

  for (var i = 0; i < n; i++) {
    var nameIp = readline().split(' ');
    var name = nameIp[0];
    var ip = nameIp[1];
    ipNames.push({ name: name, ip: ip });
  }

  for (var i = 0; i < m; i++) {
    var line = readline().split(' ');
    var ip = line[1].slice(0, -1);
    var item = ipNames.find(item => item.ip === ip);
    result.push(line + ' ' + item.name);
  }

  for (var i = 0; i < m; i++) {
    print(result[i]);
  }
}

main();

var dim = readline().split(' ');
(function(n,m){
	write(n+'***'+m);
	return print();
})(dim[0],dim[1]);


The $$$\text{$$$gcdSum$$$}$$$ of a positive integer is the $$$gcd$$$ of that integer with its sum of digits. Formally, $$$\text{$$$gcdSum$$$}(x) = gcd(x, \text{ sum of digits of } x)$$$ for a positive integer $$$x$$$. $$$gcd(a, b)$$$ denotes the greatest common divisor of $$$a$$$ and $$$b$$$ — the largest integer $$$d$$$ such that both integers $$$a$$$ and $$$b$$$ are divisible by $$$d$$$.For example: $$$\text{$$$gcdSum$$$}(762) = gcd(762, 7 + 6 + 2)=gcd(762,15) = 3$$$.Given an integer $$$n$$$, find the smallest integer $$$x \ge n$$$ such that $$$\text{$$$gcdSum$$$}(x) > 1$$$.

The first line of input contains one integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases.  Then $$$t$$$ lines follow, each containing a single integer $$$n$$$ $$$(1 \le n \le 10^{18})$$$. All test cases in one test are different.

Output $$$t$$$ lines, where the $$$i$$$-th line is a single integer containing the answer to the $$$i$$$-th test case.

'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 testCases = readline()
  while(testCases--)
    solve()
  // let testCases = readline()
  // let testNum = 1,
  //   ans = null
  // while(testCases--) {
  //   ans = solve()
  //   console.log('Case #' + (testNum++) + ': ' + ans)
  // }
}

// function to solve problems
function solve (){
  let n = BigInt(readline())
  let sum = 0,
  gcdSum = 0n,
  count = 2,
  tempGcdSum = 0,
  ans = n

  // find smallest of n, n+1 and n+2
  sum = sumOfDigits(n)
  gcdSum = findGcdSum(n, sum)
  while (count-- && gcdSum == 1) {
    n++
    if (n % 10n == 0) {
      sum = sumOfDigits(n)
    } else {
      sum++
    }
    tempGcdSum = findGcdSum(n, sum)
    // console.log('tempGcdSum:', tempGcdSum)
    if (tempGcdSum != 1) {
      ans = n
      break
    }
  }
  console.log(ans.toString())
}

function sumOfDigits (n) {
  let ans = 0n
  while (n > 0) {
    ans += n % 10n
    n = BigInt(n/10n)
  }
  return ans
}

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

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

const solve = (n) => {
    while (1) {
        let s = n.toString();
        let sum = 0n;
        for (const c of s) sum += BigInt(c);
        let res = gcd(n, sum);
        if (res > 1) return pr(s);
        n++;
    }
};

const gcd = (a, b) => b == 0 ? a : gcd(b, a % b);

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

main()

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

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

let count = -1
let inputArr = []

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

function solve(n) {
    // if (n.length <= 2) return 0
    for (let i = BigInt(n); ; i++) {
        let len = i.toString().length
        let sum = i.toString().split('').map(i => +i).reduce((acc, i) => acc + i, 0)
        sum = BigInt(sum)
        for (let j = 2n; j <= sum; j++) {
            if (BigInt(i) % j === 0n && sum % j === 0n) return i.toString()
        }

    }

}

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

'use strict';

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

let inputString = '';
let currentLine = 0;

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

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

  main();
});

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

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

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

  Array(Number(x)).fill(1).map((t, i) => {
    var a = BigInt(readline());

    // var a = read
    while (gcd(a,SUMnUMBER(a))<=1) a++
    console.log(a.toString())
    var values
  })
  // var b = a.sort((a, b) => Math.abs(a) - Math.abs(b))

}

function SUMnUMBER(x) {
  var sum = 0n
  while (x>0n){
    sum+=x% 10n
    x = x/10n
  }
  return sum
}
function gcd(a, b) {
  if (!b) {
    return a;
  }

  return gcd(b, a % b);
}

'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 testCases = readline()
  while(testCases--)
    solve()
  // let testCases = readline()
  // let testNum = 1,
  //   ans = null
  // while(testCases--) {
  //   ans = solve()
  //   console.log('Case #' + (testNum++) + ': ' + ans)
  // }
}

// function to solve problems
function solve (){
  let n = readline().split(' ').map(x => +x)
  let sum = 0,
  gcdSum = 0,
  count = 2,
  tempGcdSum = 0,
  ans = 0

  // find smallest of n, n+1 and n+2
  sum = sumOfDigits(n)
  gcdSum = findGcdSum(n, sum)
  ans = +n
  while (count-- && gcdSum == 1) {
    n++
    if (n % 10 == 0) {
      sum = sumOfDigits(n)
    } else {
      sum ++
    }
    tempGcdSum = findGcdSum(n, sum)
    // console.log('tempGcdSum:', tempGcdSum)
    if (tempGcdSum != 1) {
      gcdSum = tempGcdSum
      ans = n
      break
    }
  }
  console.log(ans)
}

function sumOfDigits (n) {
  let ans = 0
  while (n > 0) {
    ans += n % 10
    n = parseInt(n/10)
  }
  return ans
}

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


Let $$$a$$$ be a matrix of size $$$r \times c$$$ containing positive integers, not necessarily distinct. Rows of the matrix are numbered from $$$1$$$ to $$$r$$$, columns are numbered from $$$1$$$ to $$$c$$$. We can construct an array $$$b$$$ consisting of $$$r + c$$$ integers as follows: for each $$$i \in [1, r]$$$, let $$$b_i$$$ be the greatest common divisor of integers in the $$$i$$$-th row, and for each $$$j \in [1, c]$$$ let $$$b_{r+j}$$$ be the greatest common divisor of integers in the $$$j$$$-th column. We call the matrix diverse if all $$$r + c$$$ numbers $$$b_k$$$ ($$$k \in [1, r + c]$$$) are pairwise distinct. The magnitude of a matrix equals to the maximum of $$$b_k$$$.For example, suppose we have the following matrix: $$$\begin{pmatrix} 2 & 9 & 7\\ 4 & 144 & 84 \end{pmatrix}$$$ We construct the array $$$b$$$:  $$$b_1$$$ is the greatest common divisor of $$$2$$$, $$$9$$$, and $$$7$$$, that is $$$1$$$;  $$$b_2$$$ is the greatest common divisor of $$$4$$$, $$$144$$$, and $$$84$$$, that is $$$4$$$;  $$$b_3$$$ is the greatest common divisor of $$$2$$$ and $$$4$$$, that is $$$2$$$;  $$$b_4$$$ is the greatest common divisor of $$$9$$$ and $$$144$$$, that is $$$9$$$;  $$$b_5$$$ is the greatest common divisor of $$$7$$$ and $$$84$$$, that is $$$7$$$. So $$$b = [1, 4, 2, 9, 7]$$$. All values in this array are distinct, so the matrix is diverse. The magnitude is equal to $$$9$$$.For a given $$$r$$$ and $$$c$$$, find a diverse matrix that minimises the magnitude. If there are multiple solutions, you may output any of them. If there are no solutions, output a single integer $$$0$$$.

The only line in the input contains two space separated integers $$$r$$$ and $$$c$$$ ($$$1 \leq r,c \leq 500$$$) — the number of rows and the number of columns of the matrix to be found.

If there is no solution, output a single integer $$$0$$$. Otherwise, output $$$r$$$ rows. The $$$i$$$-th of them should contain $$$c$$$ space-separated integers, the $$$j$$$-th of which is $$$a_{i,j}$$$ — the positive integer in the $$$i$$$-th row and $$$j$$$-th column of a diverse matrix minimizing the magnitude. Furthermore, it must hold that $$$1 \leq a_{i,j} \leq 10^9$$$. It can be shown that if a solution exists, there is also a solution with this additional constraint (still having minimum possible magnitude).

NoteIn the first example, the GCDs of rows are $$$b_1 = 4$$$ and $$$b_2 = 1$$$, and the GCDs of columns are $$$b_3 = 2$$$ and $$$b_4 = 3$$$. All GCDs are pairwise distinct and the maximum of them is $$$4$$$. Since the GCDs have to be distinct and at least $$$1$$$, it is clear that there are no diverse matrices of size $$$2 \times 2$$$ with magnitude smaller than $$$4$$$.In the second example, no matter what $$$a_{1,1}$$$ is, $$$b_1 = b_2$$$ will always hold, so there are no diverse matrices.

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

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

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

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

  const [r, c] = arr[0].split(' ').map(a => parseInt(a))

  let ar = new Array(r)

  if(r == 1 && c == 1) {
    wr(0)
    return
  }

  if(r == 1) {
    ar[0] = new Array(c)
    let x = 2
    for(let j = 0; j < c; j++, x++) {
      ar[0][j] = x
    }
  }
  else if(c == 1) {
    let x = 2
    for(let i = 0; i < r; i++) {
      ar[i] = new Array(c)
      for(let j = 0; j < c; j++, x++) {
        ar[i][j] = x
      }
    }
  }
  else {
    for(let i = 0; i < r; i++) {
      ar[i] = new Array(c)
      for(let j = 0; j < c; j++) {
        ar[i][j] = (i + 1) * (r + j + 1)
      }
    }
  }

  for(let i = 0; i < r; i++) {
    wr(ar[i].join(' '))
  }
})

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

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

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

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

  const [r, c] = arr[0].split(' ').map(a => parseInt(a))

  let ar = new Array(r)

  if(r == 1 && c == 1) {
    wr(0)
    return
  }

  if(r == 1) {
    ar[0] = new Array(c)
    let x = 4
    for(let j = 0; j < c; j++, x+= 2) {
      ar[0][j] = x
    }
  }
  else if(c == 1) {
    let x = 4
    for(let i = 0; i < r; i++) {
      ar[i] = new Array(c)
      for(let j = 0; j < c; j++, x+= 2) {
        ar[i][j] = x
      }
    }
  }
  else {
    for(let i = 0; i < r; i++) {
      ar[i] = new Array(c)
      for(let j = 0; j < c; j++) {
        ar[i][j] = (i + 1) * (r + j + 1)
      }
    }
  }

  for(let i = 0; i < r; i++) {
    wr(ar[i].join(' '))
  }
})


Fox Ciel saw a large field while she was on a bus. The field was a n × m rectangle divided into 1 × 1 cells. Some cells were wasteland, and other each cell contained crop plants: either carrots or kiwis or grapes. After seeing the field carefully, Ciel found that the crop plants of each cell were planted in following procedure:  Assume that the rows are numbered 1 to n from top to bottom and the columns are numbered 1 to m from left to right, and a cell in row i and column j is represented as (i, j).  First, each field is either cultivated or waste. Crop plants will be planted in the cultivated cells in the order of (1, 1) → ... → (1, m) → (2, 1) → ... → (2, m) → ... → (n, 1) → ... → (n, m). Waste cells will be ignored.  Crop plants (either carrots or kiwis or grapes) will be planted in each cell one after another cyclically. Carrots will be planted in the first cell, then kiwis in the second one, grapes in the third one, carrots in the forth one, kiwis in the fifth one, and so on. The following figure will show you the example of this procedure. Here, a white square represents a cultivated cell, and a black square represents a waste cell.  Now she is wondering how to determine the crop plants in some certain cells.

In the first line there are four positive integers n, m, k, t (1 ≤ n ≤ 4·104, 1 ≤ m ≤ 4·104, 1 ≤ k ≤ 103, 1 ≤ t ≤ 103), each of which represents the height of the field, the width of the field, the number of waste cells and the number of queries that ask the kind of crop plants in a certain cell. Following each k lines contains two integers a, b (1 ≤ a ≤ n, 1 ≤ b ≤ m), which denotes a cell (a, b) is waste. It is guaranteed that the same cell will not appear twice in this section. Following each t lines contains two integers i, j (1 ≤ i ≤ n, 1 ≤ j ≤ m), which is a query that asks you the kind of crop plants of a cell (i, j).

For each query, if the cell is waste, print Waste. Otherwise, print the name of crop plants in the cell: either Carrots or Kiwis or Grapes.

Waste
Grapes
Carrots
Kiwis
Carrots
Carrots

NoteThe sample corresponds to the figure in the statement.

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const ils = ipt.split(EOL).slice(0, -1)
  const [n, m, k, t] = ils[0].split(' ').map(v => parseInt(v))

  let W = []
  ils.slice(1, k + 1).forEach(l => W.push(l.split(' ').map(v => parseInt(v))))
  let T = []
  let O = []
  ils.slice(k + 1).forEach(l => {
    l = l.split(' ').map(v => parseInt(v))
    T.push(l)
    O.push(l)
  })

  W.sort((a, b) => a[0] - b[0] || a[1] - b[1])
  O.sort((a, b) => a[0] - b[0] || a[1] - b[1])

  let i = 0
  O.forEach(p => {
    while (
         W[i]
      && (
           W[i][0] < p[0]
        || W[i][0] == p[0] && W[i][1] < p[1]
       )
    ) i++
    p.push(i)
    if (W[i] && W[i][0] == p[0] && W[i][1] == p[1]) p.push(3)
  })

  let C = ['Carrots', 'Kiwis', 'Grapes']
  T.forEach(p => {
    if (p[3]) return console.log('Waste')
    console.log(C[((p[0] - 1) * m + (p[1] - 1) - p[2]) % 3])
  })
})

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const ils = ipt.split(EOL).slice(0, -1)
  const [n, m, k, t] = ils[0].split(' ').map(v => parseInt(v))

  let W = []
  ils.slice(1, k + 1).forEach(l => W.push(l.split(' ').map(v => parseInt(v))))
  let T = []
  let O = []
  ils.slice(k + 1).forEach(l => {
    l = l.split(' ').map(v => parseInt(v))
    T.push(l)
    O.push(l)
  })

  W.sort((a, b) => a[0] - b[0] || a[1] - b[1])
  O.sort((a, b) => a[0] - b[0] || a[1] - b[1])

  let i = 0
  O.forEach(p => {
    while (
         W[i]
      && (
           W[i][0] < p[0]
        || W[i][0] == p[0] && W[i][1] < p[1]
       )
    ) i++
    p.push(i)
    if (W[i] && W[i][0] == p[0] && W[i][1] == p[1]) p.push(3)
  })

  let C = ['Carrots', 'Kiwis', 'Grapes']
  T.forEach(p => {
    if (p[3]) return console.log('Waste')
    console.log(C[(p[0] * m + p[1] - p[2]) % 3])
  })
})


Valerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mountain. So he had to find the best place to make his victory eternal!He decided to visit all n cities of Persia to find the best available mountain, but after the recent war he was too tired and didn't want to traverse a lot. So he wanted to visit each of these n cities at least once with smallest possible traverse. Persian cities are connected with bidirectional roads. You can go from any city to any other one using these roads and there is a unique path between each two cities.All cities are numbered 1 to n. Shapur is currently in the city 1 and he wants to visit all other cities with minimum possible traverse. He can finish his travels in any city.Help Shapur find how much He should travel.

First line contains a single natural number n (1 ≤ n ≤ 105) — the amount of cities. Next n - 1 lines contain 3 integer numbers each xi, yi and wi (1 ≤ xi, yi ≤ n, 0 ≤ wi ≤ 2 × 104). xi and yi are two ends of a road and wi is the length of that road.

A single integer number, the minimal length of Shapur's travel. Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).

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

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

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

function main() {
	var n = parseInt(readline()),
		edges = {};
	if (n == 1) {
		print(0);
		return;
	}
	edges.add = function (u, v, cost) {
		if (edges[u] === undefined) {
			edges[u] = [];
		}
		edges[u].push({ v: v, cost: cost });
	};
	for (var i = 1; i < n; ++i) {
		var data = tokenizeIntegers(readline()),
			u = data[0], v = data[1], cost = data[2];
		edges.add(u, v, cost);
		edges.add(v, u, cost);
	}
	var total = 0, seen = {}, maxPathCost = 0;
	function dfs(u, pathCost) {
		seen[u] = true;
		maxPathCost = Math.max(maxPathCost, pathCost);
		var vs = edges[u];
		for (var i = 0; i < vs.length; ++i) {
			var info = vs[i],
				v = info.v, cost = info.cost;
			if (!seen[v]) {
				total += cost;
				dfs(v, pathCost+cost);
			}
		}
	}
	dfs(1, 0);
	//print(total, maxPathCost);
	print(2*total-maxPathCost);
}

main();

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

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

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

function main() {
	var data = tokenizeIntegers(readline()),
		n = data[0], m = data[1], k = data[2];
}

main();


Let A = {a1, a2, ..., an} be any permutation of the first n natural numbers {1, 2, ..., n}. You are given a positive integer k and another sequence B = {b1, b2, ..., bn}, where bi is the number of elements aj in A to the left of the element at = i such that aj ≥ (i + k).For example, if n = 5, a possible A is {5, 1, 4, 2, 3}. For k = 2, B is given by {1, 2, 1, 0, 0}. But if k = 3, then B = {1, 1, 0, 0, 0}.For two sequences X = {x1, x2, ..., xn} and Y = {y1, y2, ..., yn}, let i-th elements be the first elements such that xi ≠ yi. If xi < yi, then X is lexicographically smaller than Y, while if xi > yi, then X is lexicographically greater than Y.Given n, k and B, you need to determine the lexicographically smallest A.

The first line contains two space separated integers n and k (1 ≤ n ≤ 1000, 1 ≤ k ≤ n). On the second line are n integers specifying the values of B = {b1, b2, ..., bn}.

Print on a single line n integers of A = {a1, a2, ..., an} such that A is lexicographically minimal. It is guaranteed that the solution exists.

'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  let [nk, B] = ipt.split(EOL)
  let [n, k] = nk.split(' ').map(v => parseInt(v))
  B = B.split(' ').map(v => parseInt(v))
  const A = []

  for (let i = B.length - 1; i >= 0; i--) {
    let j = 1
    let p = 0
    while (j <= B[i]) {
      if (A[p++] >= i + 1 + k) j++
    }
    A.splice(p, 0, i + 1)
  }

  console.log(A.join(' '))
})


Vlad has $$$n$$$ friends, for each of whom he wants to buy one gift for the New Year.There are $$$m$$$ shops in the city, in each of which he can buy a gift for any of his friends. If the $$$j$$$-th friend ($$$1 \le j \le n$$$) receives a gift bought in the shop with the number $$$i$$$ ($$$1 \le i \le m$$$), then the friend receives $$$p_{ij}$$$ units of joy. The rectangular table $$$p_{ij}$$$ is given in the input.Vlad has time to visit at most $$$n-1$$$ shops (where $$$n$$$ is the number of friends). He chooses which shops he will visit and for which friends he will buy gifts in each of them.Let the $$$j$$$-th friend receive $$$a_j$$$ units of joy from Vlad's gift. Let's find the value $$$\alpha=\min\{a_1, a_2, \dots, a_n\}$$$. Vlad's goal is to buy gifts so that the value of $$$\alpha$$$ is as large as possible. In other words, Vlad wants to maximize the minimum of the joys of his friends.For example, let $$$m = 2$$$, $$$n = 2$$$. Let the joy from the gifts that we can buy in the first shop: $$$p_{11} = 1$$$, $$$p_{12}=2$$$, in the second shop: $$$p_{21} = 3$$$, $$$p_{22}=4$$$.Then it is enough for Vlad to go only to the second shop and buy a gift for the first friend, bringing joy $$$3$$$, and for the second — bringing joy $$$4$$$. In this case, the value $$$\alpha$$$ will be equal to $$$\min\{3, 4\} = 3$$$Help Vlad choose gifts for his friends so that the value of $$$\alpha$$$ is as high as possible. Please note that each friend must receive one gift. Vlad can visit at most $$$n-1$$$ shops (where $$$n$$$ is the number of friends). In the shop, he can buy any number of gifts.

The first line of the input contains an integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases in the input. An empty line is written before each test case. Then there is a line containing integers $$$m$$$ and $$$n$$$ ($$$2 \le n$$$, $$$2 \le n \cdot m \le 10^5$$$) separated by a space — the number of shops and the number of friends, where $$$n \cdot m$$$ is the product of $$$n$$$ and $$$m$$$. Then $$$m$$$ lines follow, each containing $$$n$$$ numbers. The number in the $$$i$$$-th row of the $$$j$$$-th column $$$p_{ij}$$$ ($$$1 \le p_{ij} \le 10^9$$$) is the joy of the product intended for friend number $$$j$$$ in shop number $$$i$$$. It is guaranteed that the sum of the values $$$n \cdot m$$$ over all test cases in the test does not exceed $$$10^5$$$.

Print $$$t$$$ lines, each line must contain the answer to the corresponding test case — the maximum possible value of $$$\alpha$$$, where $$$\alpha$$$ is the minimum of the joys from a gift for all of Vlad's friends.

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

let inputString = '';

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

process.stdin.on("end", (_) => {
    const lines = inputString.trim().split("\n").map(string => string.trim()).filter(Boolean);

    main(lines);
});

function main(lines) {
  let index = 0;
  let T = Number(lines[index++]);
  let shops, friends;
  let arr;

  while (T--) {
    [shops, friends] = lines[index++].split(' ').map(Number);
    arr = new Array(shops);

    for (let i = 0; i < shops; ++i) {
      arr[i] = lines[index++].split(' ').map(Number);
    }

    solve(shops, friends, arr);
  }
}

function solve(shops, friends, arr) {
  let [basicFriendMaxKey, basicFriendMinKey] = [0, 1];
  let [basicFriendMaxValue, basicFriendMinValue] = [
    Math.max(arr[0][0], arr[0][1]),
    Math.min(arr[0][0], arr[0][1]),
  ];
  let curMaxKey, prevMaxKey;
  let curMaxValue, prevMaxValue;

  let friendsMap = new Array(friends).fill(0);

  for (let i = 0; i < shops; ++i) {
    [curMaxKey, prevMaxKey] = [0, 1];
    [curMaxValue, prevMaxValue] = [0, 0];

    for (let j = 0; j < friends; ++j) {
      if (arr[i][j] >= curMaxValue) {
        prevMaxValue = curMaxValue;
        prevMaxKey = curMaxKey;

        curMaxValue = arr[i][j];
        curMaxKey = j;
      } else if (arr[i][j] >= prevMaxValue) {
        prevMaxValue = arr[i][j];
        prevMaxKey = j;
      }
    }

    if (prevMaxValue > basicFriendMinValue) {
      basicFriendMinValue = prevMaxValue;
      basicFriendMinKey = prevMaxKey;

      basicFriendMaxValue = curMaxValue;
      basicFriendMaxKey = curMaxKey;
    }
  }

  friendsMap[basicFriendMinKey] = basicFriendMinValue;
  friendsMap[basicFriendMaxKey] = basicFriendMaxValue;

  for (let i = 0; i < shops; ++i) {
    for (let j = 0; j < friends; ++j) {
      if (j === basicFriendMinKey || j === basicFriendMaxKey) {
        continue;
      }

      friendsMap[j] = Math.max(friendsMap[j], arr[i][j]);
    }
  }

  console.log(Math.min(...friendsMap));
}

'use strict';
const readline = require('readline');
const util = require('util');
const rl = readline.createInterface({
    input: process.stdin,
});
let pos = 0;
const words = [];
rl.on('line', (line) => {
    words.push.apply(words, line.split(' ').filter(s => s != ''));
});
rl.on('close', main);
function check(b) {
    if (!b) {
        process.stderr.write(`${new Error().stack}\n`);
        process.exit(-1);
    }
}
function printf(...args) {
    process.stdout.write(util.format(...args));
}
function nextInt() {
    return Math.trunc(Number(words[pos++]));
}
function nextStr() {
    return words[pos++];
}
function af(l) {
    return Array.from({ length: l });
}
const INIT = -1;
let m;
let n;
let p;
function can(mid) {
    const friends = af(n).fill(0);
    const shops = af(m).fill(0);
    for (let i = 0; i < m; i++) {
        for (let j = 0; j < n; j++) {
            if (p[i][j] >= mid) {
                friends[j]++;
                shops[i]++;
            }
        }
    }
    for (let i = 0; i < n; i++) {
        if (friends[i] == 0) {
            return false;
        }
    }
    for (let i = 0; i < m; i++) {
        if (shops[i] > 1) {
            return true;
        }
    }
    return false;
}
function main() {
    let tc = nextInt();
    while (tc-- > 0) {
        m = nextInt();
        n = nextInt();
        p = Array.from({ length: m });
        let mx = 0;
        for (let i = 0; i < m; i++) {
            p[i] = af(n);
            for (let j = 0; j < n; j++) {
                p[i][j] = nextInt();
                mx = Math.max(mx, p[i][j]);
            }
        }
        let lo = 0;
        let hi = mx + 1;
        let ans = 0;
        while (lo < hi) {
            let mid = lo + Math.trunc((hi - lo) / 2);
            if (!can(mid)) {
                hi = mid;
            }
            else {
                lo = mid + 1;
                ans = mid;
            }
        }
        printf("%d\n", ans);
    }
}

const readline = require('readline')

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
})
const lines = []
rl.on('line', (input) => {
    lines.push(input);
})
rl.on('close', () => {
// (function() {
    // const lines = require('fs').readFileSync('test.in', 'utf8').split('\n')
    let l = 0;
    let t = +lines[l++]
    const output = []
    for (let i = 0; i < t; i++) {
        l++
        const [m, n] = lines[l++].trim().split(' ').map(Number)
        const arr = lines.slice(l, l + m).map(str => str.trim().split(' ').map(Number))
        l += m
        output[i] = solve(n, m, arr)
    }
    console.log(output.join('\n'))
// })()
})

function solve(n, m, arr) {
    return binarySearch(1, 1e9, x => check(n, m, arr, x))
}
function binarySearch(l, r, fn) {
    while (l <= r) {
        const m = Math.floor((l + r) / 2)
        if (fn(m)) {
            l = m + 1
        } else {
            r = m - 1
        }
    }
    return r
}
function check(n, m, arr, min) {
    const map = {}
    let has2 = 0
    for (let i = 0; i < n; i++) {
        let has = 0
        for (let j = 0; j < m; j++) {
            if (arr[j][i] >= min) {
                map[j] = (map[j] || 0) + 1
                has = 1
                if (map[j] > 1) has2 = 1
            }
        }
        if (!has) return false
    }
    return has2
}

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

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

function main () {
	let T = rn();
	while (T--) {
		rl();
		const [m, n] = rna();
		const p = [];
		for (let i = 0; i < m; i++)
			p[i] = rna();

		const mxjoy = Array(n).fill(0);
		let mxsmx = 0;
		for (let i = 0; i < m; i++) {
			let fmx = 0, smx = 0;
			for (let j = 0; j < n; j++) {
				mxjoy[j] = Math.max(mxjoy[j], p[i][j]);
				if (p[i][j] > fmx) {
					[fmx, smx] = [p[i][j], fmx]
				} else if (p[i][j] > smx)
					smx = p[i][j];
			}
			mxsmx = Math.max(mxsmx, smx);
			//console.log({mxsmx})
		}

		const ans = Math.min(mxsmx, ...mxjoy);

		console.log(ans);
	}
}

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

let inputString = '';

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

process.stdin.on("end", (_) => {
    const lines = inputString.trim().split("\n").map(string => string.trim()).filter(Boolean);

    console.log(lines);
});

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

let inputString = "";

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

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

    console.log(inputString);
});