There are n points on a straight line, and the i-th point among them is located at xi. All these coordinates are distinct.Determine the number m — the smallest number of points you should add on the line to make the distances between all neighboring points equal.

The first line contains a single integer n (3 ≤ n ≤ 100 000) — the number of points. The second line contains a sequence of integers x1, x2, ..., xn ( - 109 ≤ xi ≤ 109) — the coordinates of the points. All these coordinates are distinct. The points can be given in an arbitrary order.

Print a single integer m — the smallest number of points you should add on the line to make the distances between all neighboring points equal.

NoteIn the first example you can add one point with coordinate 0.In the second example the distances between all neighboring points are already equal, so you shouldn't add anything.

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

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

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

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

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

print(m)

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

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

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

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

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

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

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

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

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

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

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

print(ans);

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

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

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

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

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

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

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

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

var g = 0

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

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

print(cnt - n)

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

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

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

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

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

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

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

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

var distances = [];

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

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

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

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

print(cnt);

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

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

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

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

print(sc);

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

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

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

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

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

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

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

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

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

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

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

var g = 0

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

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

print(cnt - n)

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

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

var padding;

var m = 0;

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

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

print(m);


There are n servers in a laboratory, each of them can perform tasks. Each server has a unique id — integer from 1 to n.It is known that during the day q tasks will come, the i-th of them is characterized with three integers: ti — the moment in seconds in which the task will come, ki — the number of servers needed to perform it, and di — the time needed to perform this task in seconds. All ti are distinct.To perform the i-th task you need ki servers which are unoccupied in the second ti. After the servers begin to perform the task, each of them will be busy over the next di seconds. Thus, they will be busy in seconds ti, ti + 1, ..., ti + di - 1. For performing the task, ki servers with the smallest ids will be chosen from all the unoccupied servers. If in the second ti there are not enough unoccupied servers, the task is ignored.Write the program that determines which tasks will be performed and which will be ignored.

The first line contains two positive integers n and q (1 ≤ n ≤ 100, 1 ≤ q ≤ 105) — the number of servers and the number of tasks.  Next q lines contains three integers each, the i-th line contains integers ti, ki and di (1 ≤ ti ≤ 106, 1 ≤ ki ≤ n, 1 ≤ di ≤ 1000) — the moment in seconds in which the i-th task will come, the number of servers needed to perform it, and the time needed to perform this task in seconds. The tasks are given in a chronological order and they will come in distinct seconds.

Print q lines. If the i-th task will be performed by the servers, print in the i-th line the sum of servers' ids on which this task will be performed. Otherwise, print -1.

NoteIn the first example in the second 1 the first task will come, it will be performed on the servers with ids 1, 2 and 3 (the sum of the ids equals 6) during two seconds. In the second 2 the second task will come, it will be ignored, because only the server 4 will be unoccupied at that second. In the second 3 the third task will come. By this time, servers with the ids 1, 2 and 3 will be unoccupied again, so the third task will be done on all the servers with the ids 1, 2, 3 and 4 (the sum of the ids is 10).In the second example in the second 3 the first task will come, it will be performed on the servers with ids 1 and 2 (the sum of the ids is 3) during three seconds. In the second 5 the second task will come, it will be performed on the server 3, because the first two servers will be busy performing the first task.

"use strict";

var serversReturnedAt = [];
var serversRequiredAt = [];
var isEmpty = [];

var MAX_TIME = 1000 * 1000 + 10;

function init (servers) {
    for (var t = 0; t < 2 * MAX_TIME; t++) {
        serversReturnedAt.push([]);
        serversRequiredAt.push([]);
    }
    for (var i = 0; i < servers; i++) {
        isEmpty.push(true);
    }
}

function obtainFirstServers (servers) {
    var chosen = [];
    for (var i = 0; i < isEmpty.length; i++) {
        if (isEmpty[i] && chosen.length < servers) {
            chosen.push(i);
        }
    }
    if (chosen.length < servers) {
        return undefined;
    }
    return chosen;
}

function Query (id, servers, duration) {
    this.id = id;
    this.servers = servers;
    this.duration = duration;
}

function add (a, b) {
    return a + b;
}

function solve () {
    var result = {};
    for (var time = 0; time < MAX_TIME; time++) {
        for (var i = 0; i < serversReturnedAt[time].length; i++) {
            isEmpty[serversReturnedAt[time][i]] = true;
        }
        for (i = 0; i < serversRequiredAt[time].length; i++) {
            var query = serversRequiredAt[time][i];
            var chosen = obtainFirstServers (query.servers);
            if (!chosen) {
                result[query.id] = -1;
            } else {
                result[query.id] = chosen.length + chosen.reduce(add, 0);
                for (var j = 0; j < chosen.length; j++) {
                    isEmpty[chosen[j]] = false;
                    serversReturnedAt[time + query.duration].push(chosen[j]);
                }
            }
        }
    }
    return result;
}

var line = readline().split(' ');
var servers = parseInt(line[0]);
var queries = parseInt(line[1]);
init(servers);
for (var i = 0; i < queries; i++) {
    line = readline().split(' ');
    var t = parseInt(line[0]);
    var servers = parseInt(line[1]);
    var duration = parseInt(line[2]);
    serversRequiredAt[t].push(new Query(i, servers, duration));
}
var result = solve();
for (i = 0; i < queries; i++) {
    print(result[i]);
}


In this problem you will have to deal with a real algorithm that is used in the VK social network.As in any other company that creates high-loaded websites, the VK developers have to deal with request statistics regularly. An important indicator reflecting the load of the site is the mean number of requests for a certain period of time of T seconds (for example, T = 60 seconds = 1 min and T = 86400 seconds = 1 day). For example, if this value drops dramatically, that shows that the site has access problem. If this value grows, that may be a reason to analyze the cause for the growth and add more servers to the website if it is really needed.However, even such a natural problem as counting the mean number of queries for some period of time can be a challenge when you process the amount of data of a huge social network. That's why the developers have to use original techniques to solve problems approximately, but more effectively at the same time.Let's consider the following formal model. We have a service that works for n seconds. We know the number of queries to this resource at at each moment of time t (1 ≤ t ≤ n). Let's formulate the following algorithm of calculating the mean with exponential decay. Let c be some real number, strictly larger than one.// setting this constant value correctly can adjust   // the time range for which statistics will be calculateddouble c = some constant value; // as the result of the algorithm's performance this variable will contain // the mean number of queries for the last // T seconds by the current moment of timedouble mean = 0.0; for t = 1..n: // at each second, we do the following:    // at is the number of queries that came at the last second;    mean = (mean + at / T) / c;Thus, the mean variable is recalculated each second using the number of queries that came at that second. We can make some mathematical calculations and prove that choosing the value of constant c correctly will make the value of mean not very different from the real mean value ax at t - T + 1 ≤ x ≤ t. The advantage of such approach is that it only uses the number of requests at the current moment of time and doesn't require storing the history of requests for a large time range. Also, it considers the recent values with the weight larger than the weight of the old ones, which helps to react to dramatic change in values quicker.However before using the new theoretical approach in industrial programming, there is an obligatory step to make, that is, to test its credibility practically on given test data sets. Your task is to compare the data obtained as a result of the work of an approximate algorithm to the real data. You are given n values at, integer T and real number c. Also, you are given m moments pj (1 ≤ j ≤ m), where we are interested in the mean value of the number of queries for the last T seconds. Implement two algorithms. The first one should calculate the required value by definition, i.e. by the formula . The second algorithm should calculate the mean value as is described above. Print both values and calculate the relative error of the second algorithm by the formula , where approx is the approximate value, obtained by the second algorithm, and real is the exact value obtained by the first algorithm.

The first line contains integer n (1 ≤ n ≤ 2·105), integer T (1 ≤ T ≤ n) and real number c (1 < c ≤ 100) — the time range when the resource should work, the length of the time range during which we need the mean number of requests and the coefficient c of the work of approximate algorithm. Number c is given with exactly six digits after the decimal point. The next line contains n integers at (1 ≤ at ≤ 106) — the number of queries to the service at each moment of time. The next line contains integer m (1 ≤ m ≤ n) — the number of moments of time when we are interested in the mean number of queries for the last T seconds. The next line contains m integers pj (T ≤ pj ≤ n), representing another moment of time for which we need statistics. Moments pj are strictly increasing.

Print m lines. The j-th line must contain three numbers real, approx and error, where:    is the real mean number of queries for the last T seconds;  approx is calculated by the given algorithm and equals mean at the moment of time t = pj (that is, after implementing the pj-th iteration of the cycle);   is the relative error of the approximate algorithm.  The numbers you printed will be compared to the correct numbers with the relative or absolute error 10 - 4. It is recommended to print the numbers with at least five digits after the decimal point.

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

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

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

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

var m = parseInt(readline());

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

var mean = [0.0];

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

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

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

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

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

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

var m = Number(readline());

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

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


Petya has n positive integers a1, a2, ..., an. His friend Vasya decided to joke and replaced all digits in Petya's numbers with a letters. He used the lowercase letters of the Latin alphabet from 'a' to 'j' and replaced all digits 0 with one letter, all digits 1 with another letter and so on. For any two different digits Vasya used distinct letters from 'a' to 'j'.Your task is to restore Petya's numbers. The restored numbers should be positive integers without leading zeros. Since there can be multiple ways to do it, determine the minimum possible sum of all Petya's numbers after the restoration. It is guaranteed that before Vasya's joke all Petya's numbers did not have leading zeros.

The first line contains a single integer n (1 ≤ n ≤ 1 000) — the number of Petya's numbers. Each of the following lines contains non-empty string si consisting of lowercase Latin letters from 'a' to 'j' — the Petya's numbers after Vasya's joke. The length of each string does not exceed six characters.

Determine the minimum sum of all Petya's numbers after the restoration. The restored numbers should be positive integers without leading zeros. It is guaranteed that the correct restore (without leading zeros) exists for all given tests.

NoteIn the first example, you need to replace the letter 'a' with the digit 1, the letter 'b' with the digit 0, the letter 'd' with the digit 2, the letter 'e' with the digit 3, and the letter 'j' with the digit 4. So after the restoration numbers will look like [10, 23, 14]. The sum of them is equal to 47, which is the minimum possible sum of the numbers after the correct restoration.In the second example the numbers after the restoration can look like: [120468, 3579, 2468, 10024, 3]. In the second example the numbers after the restoration can look like: [11, 22, 11].


Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor «Textpad» decided to introduce this functionality into the fourth release of the product.You are to implement the alignment in the shortest possible time. Good luck!

The input file consists of one or more lines, each of the lines contains Latin letters, digits and/or spaces. The lines cannot start or end with a space. It is guaranteed that at least one of the lines has positive length. The length of each line and the total amount of the lines do not exceed 1000.

Format the given text, aligning it center. Frame the whole text with characters «*» of the minimum size. If a line cannot be aligned perfectly (for example, the line has even length, while the width of the block is uneven), you should place such lines rounding down the distance to the left or to the right edge and bringing them closer left or right alternatively (you should start with bringing left). Study the sample tests carefully to understand the output format better.

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

  lines = [];

  maxLen = 0;

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

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

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

  incl = false;

  print(hr);

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

  print(hr);

}).call(this);

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

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

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

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

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

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

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

'use strict';

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

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

//code

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

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

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

}

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

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

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

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

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

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

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

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

var ss = []
var w = 0

var lo = false
var l

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

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

out.push(sts)

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

out.push(sts)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.

The first line contains two space-separated integers n, s (1 ≤ n, s ≤ 100). The i-th of the next n lines contains two integers xi, yi (1 ≤ xi ≤ 100; 0 ≤ yi < 100), where xi represents the number of dollars and yi the number of cents needed in order to buy the i-th type of sugar.

Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.

NoteIn the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.

var input = readline().split(" "), n = +input[0], s = +input[1] * 100;
var max = 0, check = false;

for(var i = 0; i < n; i++){
	input = readline().split(" ").map(Number);
	input = input[0] * 100 + input[1];

	if(s >= input){
		max = Math.max(max, ((s - input) % 100));
		check = true;
	}
}

if(check){write(max)}
else{write(-1)}

 var vector = readline().split(' ').map(Number);
    var n = vector[0];
    var s = vector[1];
    var max = -1;
    for (var i = 0; i < n; i++)
    {
        var vector2 = readline().split(' ').map(Number);
        var dolar = vector2[0];
        var centavos = vector2[1];
        if (dolar + centavos / 100.0 <= s){
            max = Math.max(max, (100 - centavos) % 100);
        }
    }
    print(max);

 var vector = readline().split(' ').map(Number);
    var n = vector[0];
    var s = vector[1];
    var max = -1;
    for (var i = 0; i < n; i++)
    {
        var vector2 = readline().split(' ').map(Number);
        var dolar = vector2[0];
        var centavos = vector2[1];
        if (dolar + centavos / 100.0 <= s)
            max = Math.max(max, (100 - centavos) % 100);
    }
    print(max);

;(function () {
    var n, s, l, ans = -1;
    l = readline().split(' ').map(Number);
    n = l[0];
    s = l[1] * 100;

    while (n--) {
        var q, w;
        l = readline().split(' ').map(Number);
        q = l[0] * 100 + l[1];
        w = (100 - l[1]) % 100;

        if (s >= q) {
            ans = Math.max(ans, w);
        }
    }

    print(ans);

}.call(this));

// 463A     Caisa и сахар

// var n = parseInt(readline());

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

var n = input_line[0];
var s = input_line[1];
var arr = [];

var count;
var flagBuy = false;
var max = 0;

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

    if (((arr[0] * 100) + arr[1]) <= (s * 100)) {
        flagBuy = true;
        if ((max < (100 - arr[1])) && (arr[1] != 0)) max = 100 - arr[1];
    };
};

if (flagBuy) {
    count = max;
} else {
    count = -1;
};

print(count);

var toInt = i => parseInt( i, 10 );
var input = readline().split( " " ).map( toInt ),
    s = input[ 1 ],
    centsInDollar = 100,
    count = -1;
while( input = readline() ) {
  input = input.split( " " ).map( toInt );
  var dollars = input[ 0 ],
      cents = input[ 1 ];
  if ( dollars + Math.ceil( cents / centsInDollar ) <= s ) {
    count = Math.max( (centsInDollar - cents) % centsInDollar, count );
  }
}
print( count );

var input = readline().split(" "), n = +input[0], s = +input[1] * 100;
var max = 0;

for(var i = 0; i < n; i++){
	input = readline().split(" ").map(Number);
	input = input[0] * 100 + input[1];

	if(s >= input){
		max = Math.max(max, ((s - input) % 100));
	}
}

write(max);

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}

			k = k.map(function (e) {
				if (e > s) return 0;
				e = 100 - parseInt(e.toString().slice(-2));
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t].concat(k));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}

			k = k.map(function (e) {
				if (e > s || e === 0) return 0;
				e = 100 - parseInt(e.toString().slice(-2));
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t || 0].concat(k.length ? k : [0]));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}
			k.splice(0, 1);

			if (k.slice(-1) > s) {
				k.splice(-1);
			}

			k = k.map(function (e) {
				e = 100 - +e.toString().slice(-2);
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t].concat(k));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			var k = l;
			while (k <= s) {
				var r = 100 - (k % 100);
				r = r === 100 ? 0 : r;
				t = (t === null || t < r) ? r : t;
				k += l;
			}
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}
			k.splice(-1); k.splice(0, 1);

			k = k.map(function (e) {
				e = 100 - +e.toString().slice(-2);
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t].concat(k));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l, q = [];
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			var k = l;
			while (k <= s) {
				var r = 100 - (k % 100);
				r = r === 100 ? 0 : r;
				t = (t === null || t < r) ? r : t;
				k += l;

				if (t === 99) q.push(l);
			}
		}

		if (t === 99) return q;
		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}

			k = k.map(function (e) {
				if (e > s || e === 0) return 0;
				e = 100 - parseInt(e.toString().slice(-2));
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t].concat(k));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		var r = 0;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}

			k = k.map(function (e) {
				if (e > s) return 0;
				e = 100 - parseInt(e.toString().slice(-2));
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t].concat(k));
			if (t === 99) r = l;
		}
		if (t === 99) return r;
		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;
			if ((l%100) === 0) {
				t = Math.max.apply(null, [t || 0].concat(0));
				continue;
			}

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}

			k = k.map(function (e) {
				if (e > s || e === 0) return 0;
				e = 100 - parseInt(e.toString().slice(-2));
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t || 0].concat(k.length ? k : [0]));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l, q = [];
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			var k = l;
			while (k <= s) {
				var r = 100 - (k % 100);
				r = r === 100 ? 0 : r;
				t = (t === null || t < r) ? r : t;
				k += l;

				if (t === 99 && q.indexOf(l) === -1) q.push(l);
			}
		}

		if (t === 99) return q;
		return t === null ? -1 : t;
	}());
}.call(this));

;(function () {
	print(function () {
		var n, s, l;
		l = readline().split(' ').map(Number);
		n = l[0];
		s = l[1] * 100;

		var t = null;
		while (n--) {
			l = readline().split(' ').map(Number);
			l = l[0] * 100 + l[1];

			if (l > s) continue;
			if ((l % 100) === 0) return 0;

			var k = [0];
			while (k.slice(-1)[0] <= s) {
				k.push(k.slice(-1)[0] + l);
			}

			k = k.map(function (e) {
				if (e > s) return 0;
				e = 100 - parseInt(e.toString().slice(-2));
				return e !== 100 ? e : 0;
			});

			t = Math.max.apply(null, [t].concat(k));
		}

		return t === null ? -1 : t;
	}());
}.call(this));

// 463A     Caisa и сахар

// var n = parseInt(readline());

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

var n = input_line[0];
var s = input_line[1];
var arr = [];

var count;
var flagBuy = false;
var max = 0;

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

    if (((arr[0] * 100) + arr[1]) <= (s * 100)) {
        flagBuy = true;
        if (max < arr[1]) max = arr[1];
    };
};

if (flagBuy) {
    count = max;
} else {
    count = -1;
};

print(count);

var toInt = i => parseInt( i, 10 );
var input = readline().split( " " ).map( toInt ),
    s = input[ 1 ],
    count = -1;
while( input = readline() ) {
  input = input.split( " " ).map( toInt );
  var dollars = input[ 0 ],
      cents = input[ 1 ];
  if ( dollars < s && cents > 0 ) {
    count = Math.max( 100 - cents, count );
  }
}
print( count );


Mihai plans to watch a movie. He only likes palindromic movies, so he wants to skip some (possibly zero) scenes to make the remaining parts of the movie palindromic.You are given a list $$$s$$$ of $$$n$$$ non-empty strings of length at most $$$3$$$, representing the scenes of Mihai's movie.A subsequence of $$$s$$$ is called awesome if it is non-empty and the concatenation of the strings in the subsequence, in order, is a palindrome.Can you help Mihai check if there is at least one awesome subsequence of $$$s$$$?A palindrome is a string that reads the same backward as forward, for example strings "z", "aaa", "aba", "abccba" are palindromes, but strings "codeforces", "reality", "ab" are not.A sequence $$$a$$$ is a non-empty subsequence of a non-empty sequence $$$b$$$ if $$$a$$$ can be obtained from $$$b$$$ by deletion of several (possibly zero, but not all) elements.

The first line of the input contains a single integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases. The description of test cases follows. The first line of each test case contains a single integer $$$n$$$ ($$$1 \le n \le 10^5$$$) — the number of scenes in the movie. Then follows $$$n$$$ lines, the $$$i$$$-th of which containing a single non-empty string $$$s_i$$$ of length at most $$$3$$$, consisting of lowercase Latin letters. It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^5$$$.

For each test case, print "YES" if there is an awesome subsequence of $$$s$$$, or "NO" otherwise (case insensitive).

6

5

zx

ab

cc

zx

ba

2

ab

bad

4

co

def

orc

es

3

a

b

c

3

ab

cd

cba

2

ab

ab

NoteIn the first test case, an awesome subsequence of $$$s$$$ is $$$[ab, cc, ba]$$$

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
rl.on('line', (line) => {
    lines.push(line.trim());

}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let set2 = new Set();
        let set3 = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]) {
                wasInterrupted = true;
                break;
            }

            if (scene.length === 2 && (set2.has([...scene].reverse().join('')))) {
                wasInterrupted = true;
                break;
            }

            if (scene.length === 3
                && (set3.has([...scene.slice(1)].reverse().join(''))
                    || set3.has([...scene].reverse().join('')))) {
                wasInterrupted = true;
                break;
            }

            if (scene.length === 2) {
                set2.add(scene);
                set3.add(scene);
            }

            if (scene.length === 3) {
                set3.add(scene);
                set2.add(scene.slice(0, scene.length - 1))
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

/* KEEP BELOW CODE AS IT IS */
// copy-pasted from: https://codeforces.com/blog/entry/78878?f0a28=1
/**
 * This code has been taken from: https://codeforces.com/blog/entry/69610
 * I am not the owner of the readLine function below, understanding them require knowledge of basic NodeJS I/O and streams
 */
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 nextLine() {
    return inputString[currentLine++];
}

function nextInt() {
    return parseInt(nextLine());
}

function nextFloat() {
    return parseFloat(nextLine());
}

/** BELOW HERE START WRITING YOUR CODE IN main() FUNCTION */
function main() {

    function solve(words, set, additional) {
        for (const word of words) {
            const len = word.length;
            const reversed = word.split("").reverse().join("")
            if (word[0] === word[len - 1] || set[reversed] !== undefined) {
                return "YES";
            }
            set[word] = true;
            if (len === 2) {
                if (additional[reversed] !== undefined) {
                    return "YES";
                }
                continue;
            }

            const last = reversed.substring(0, 2)
            if (set[last] !== undefined) {
                return "YES";
            }
            additional[word.substring(0, 2)] = true;
        }
        return "NO";
    }

    let amount = nextInt();

    while (amount--) {
        const wordAmount = nextInt();
        const words = [];
        for (let i = 0; i < wordAmount; i++) {
            words.push(nextLine());
        }
        console.log(solve(words, {}, {}));
    }
}

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let counter = 0;
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());
    if (line.trim() === "uev") {
        print = true;
    }
    if (print) {
        process.stdout.write(line + " ");
        counter++;
        if (counter === 10) {
            process.stdout.write("\n");
            counter = 0;
        }
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let counter = 0;
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());
    if (line.trim() === "iyq") {
        print = true;
    }
    if (print) {
        process.stdout.write(line + " ");
        counter++;
        if (counter === 10) {
            process.stdout.write("\n");
            counter = 0;
        }
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let counter = 0;
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());

    if (Number(line.trim()) && print) {
        printTrue = true;
    }
    if (line.trim() === "1") {
        print = true;
    }
    if (printTrue) {
        process.stdout.write(line + " ");
        counter++;
        if (counter === 10) {
            process.stdout.write("\n");
            counter = 0;
        }
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let counter = 0;
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());

    if (Number(line.trim()) && print) {
        printTrue = true;
    }
    if (line.trim() === "118") {
        print = true;
    }
    if (printTrue) {
        process.stdout.write(line + " ");
        counter++;
        if (counter === 10) {
            process.stdout.write("\n");
            counter = 0;
        }
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());

    if (Number(line.trim()) && print) {
        printTrue = true;
    }
    if (line.trim() === "118") {
        print = true;
    }
    if (printTrue) {
        process.stdout.write(line + " ");
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());

    if (Number(line.trim()) && print) {
        printTrue = true;
    }
    if (line.trim() === "230") {
        print = true;
    }
    if (printTrue) {
        process.stdout.write(line + "\n");
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let print = false;
let printTrue = false;
rl.on('line', (line) => {
    lines.push(line.trim());

    if (Number(line.trim()) && print) {
        printTrue = true;
    }
    if (line.trim() === "100") {
        print = true;
    }
    if (printTrue) {
        process.stdout.write(line + "\n");
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let print = false;
rl.on('line', (line) => {
    lines.push(line.trim());
    if (line.trim() === "100") {
        print = true;
    }
    if (print) {
        process.stdout.write(line + "\n");
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
let print = false;
rl.on('line', (line) => {
    lines.push(line.trim());
    if (line.trim() === "100") {
        print = true;
    }
    if (print) {
        process.stdout.write(line);
    }
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
const print = false;
rl.on('line', (line) => {
    lines.push(line.trim());
    if (line.trim() === "100")
        process.stdout.write(line);
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
const print = false;
rl.on('line', (line) => {
    lines.push(line.trim());
    if (line.trim() === "100\n")
        process.stdout.write(line);
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
rl.on('line', (line) => {
    lines.push(line.trim());
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || scene.length > 2 && duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
rl.on('line', (line) => {
    lines.push(line.trim());
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]
                || duplicates.has([...scene].reverse().join(''))
                || duplicates.has([...scene.slice(1)].reverse().join(''))) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(0, scene.length - 1));
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});

const readline = require("readline");
const rl = readline.createInterface({
    input: process.stdin,
});
const lines = [];
rl.on('line', (line) => {
    lines.push(line.trim());
}).on('close', () => {
    const t = Number(lines[0]);
    let prevN = 1;

    for (let i = 0; i < t; i++) {
        let wasInterrupted = false;
        const n = Number(lines[i + prevN]);
        let duplicates = new Set();
        for (let j = 0; j < n; j++) {
            const scene = lines[j + prevN + i + 1]
            if (scene[0] === scene[scene.length - 1]) {
                wasInterrupted = true;
                break;
            }
            duplicates.add(scene);
            if (scene.length > 2) {
                duplicates.add(scene.slice(1));
            }
        }
        if (!wasInterrupted) {
            for (let scene of duplicates.values()) {
                if (duplicates.has([...scene].reverse().join(''))) {
                    wasInterrupted = true;
                    break;
                }
            }
        }
        prevN += n;
        if (wasInterrupted) {
            process.stdout.write('YES\n');
        } else {
            process.stdout.write('NO\n');
        }
    }
});


First-rate specialists graduate from Berland State Institute of Peace and Friendship. You are one of the most talented students in this university. The education is not easy because you need to have fundamental knowledge in different areas, which sometimes are not related to each other. For example, you should know linguistics very well. You learn a structure of Reberland language as foreign language. In this language words are constructed according to the following rules. First you need to choose the "root" of the word — some string which has more than 4 letters. Then several strings with the length 2 or 3 symbols are appended to this word. The only restriction —  it is not allowed to append the same string twice in a row. All these strings are considered to be suffixes of the word (this time we use word "suffix" to describe a morpheme but not the few last characters of the string as you may used to). Here is one exercise that you have found in your task list. You are given the word s. Find all distinct strings with the length 2 or 3, which can be suffixes of this word according to the word constructing rules in Reberland language. Two strings are considered distinct if they have different length or there is a position in which corresponding characters do not match. Let's look at the example: the word abacabaca is given. This word can be obtained in the following ways: , where the root of the word is overlined, and suffixes are marked by "corners". Thus, the set of possible suffixes for this word is {aca, ba, ca}.

The only line contains a string s (5 ≤ |s| ≤ 104) consisting of lowercase English letters.

On the first line print integer k — a number of distinct possible suffixes. On the next k lines print suffixes.  Print suffixes in lexicographical (alphabetical) order.

NoteThe first test was analysed in the problem statement. In the second example the length of the string equals 5. The length of the root equals 5, so no string can be used as a suffix.

const memo = {};
const res = {};

function resolve(s, prev) {
  if (!memo[s + ' ' + prev]) {
    memo[s + ' ' + prev] = true;
    var suffix2 = s.slice(s.length - 2);
    if (suffix2 !== prev && s.length > 6) {
      res[suffix2] = true;
      resolve(s.slice(0, s.length - 2), suffix2);
    }
    var suffix3 = s.slice(s.length - 3);
    if (suffix3 !== prev && s.length > 7) {
      res[suffix3] = true;
      resolve(s.slice(0, s.length - 3), suffix3);
    }
  }
}

/*
resolve('abcdeabzzzzzzzz', null);
console.log(res);
*/

var s = readline();

resolve(s, null);

var suffixes = Object.keys(res).sort();

print(suffixes.length);

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

var inpStr = readline();
inpStr = inpStr.substr(5);
var suffixes = [], visited = [];
function getSuffixes(str, lastSuffix){
    if(str.length < 2 || (visited[str.length] && visited[str.length][lastSuffix])){
        return;
    }
    if(!visited[str.length]){
        visited[str.length] = [];
    }
    visited[str.length][lastSuffix] = true;
    if(str.length === 2){
        if(lastSuffix !== str){
            if(suffixes.indexOf(str) === -1){
                suffixes.push(str);
            }
        }
        return;
    } else {
        var strLen2 = str.substr(-2);
        if(lastSuffix !== strLen2){
            if(suffixes.indexOf(strLen2) === -1){
                suffixes.push(strLen2);
            }
            getSuffixes(str.substring(0, str.length-2), strLen2);
        }

        var strLen3 = str.substr(-3);
        if(lastSuffix !== strLen3){
            if(suffixes.indexOf(strLen3) === -1){
                suffixes.push(strLen3);
            }
            getSuffixes(str.substring(0, str.length-3), strLen3);
        }
    }
}
getSuffixes(inpStr, "");
print(suffixes.length);
suffixes.sort().forEach(function(suffix){
    print(suffix);
})

const memo = {};
const res = {};

function resolve(s, prev) {
  if (!memo[s]) {
    memo[s] = true;
    var suffix2 = s.slice(s.length - 2);
    if (suffix2 !== prev && s.length > 6) {
      res[suffix2] = true;
      resolve(s.slice(0, s.length - 2), suffix2);
    }
    var suffix3 = s.slice(s.length - 3);
    if (suffix3 !== prev && s.length > 7) {
      res[suffix3] = true;
      resolve(s.slice(0, s.length - 3), suffix3);
    }
  }
}

var s = readline();

resolve(s, null);

var suffixes = Object.keys(res).sort();

print(suffixes.length + '\n');

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

var inpStr = readline();
inpStr = inpStr.substr(5);
var suffixes = [];
function getSuffixes(str){
    if(str.length < 2){
        return;
    } else if(str.length === 2){
        if(suffixes.indexOf(str) === -1){
            suffixes.push(str);
        }
        return;
    } else {
        var strLen2 = str.substr(-2);
        if(suffixes.indexOf(strLen2) === -1){
            suffixes.push(strLen2);
        }
        getSuffixes(str.substring(0, str.length-2));

        var strLen3 = str.substr(-3);
        if(suffixes.indexOf(strLen3) === -1){
            suffixes.push(strLen3);
        }
        getSuffixes(str.substring(0, str.length-3));
    }
}
getSuffixes(inpStr);
print(suffixes.length)
suffixes.sort().forEach(function(suffix){
    print(suffix);
})

var inpStr = readline();
inpStr = inpStr.substr(5);
var suffixes = [], visited = [];
function getSuffixes(str, lastSuffix){
    if(str.length < 2 || visited[str.length]){
        return;
    }
    visited[str.length] = true;
    if(str.length === 2){
        if(lastSuffix !== str){
            if(suffixes.indexOf(str) === -1){
                suffixes.push(str);
            }
        }
        return;
    } else {
        var strLen2 = str.substr(-2);
        if(lastSuffix !== strLen2){
            if(suffixes.indexOf(strLen2) === -1){
                suffixes.push(strLen2);
            }
            getSuffixes(str.substring(0, str.length-2), strLen2);
        }

        var strLen3 = str.substr(-3);
        if(lastSuffix !== strLen3){
            if(suffixes.indexOf(strLen3) === -1){
                suffixes.push(strLen3);
            }
            getSuffixes(str.substring(0, str.length-3), strLen3);
        }
    }
}
getSuffixes(inpStr, "");
print(suffixes.length);
suffixes.sort().forEach(function(suffix){
    print(suffix);
})


Polycarp wrote on the board a string $$$s$$$ containing only lowercase Latin letters ('a'-'z'). This string is known for you and given in the input.After that, he erased some letters from the string $$$s$$$, and he rewrote the remaining letters in any order. As a result, he got some new string $$$t$$$. You have to find it with some additional information.Suppose that the string $$$t$$$ has length $$$m$$$ and the characters are numbered from left to right from $$$1$$$ to $$$m$$$. You are given a sequence of $$$m$$$ integers: $$$b_1, b_2, \ldots, b_m$$$, where $$$b_i$$$ is the sum of the distances $$$|i-j|$$$ from the index $$$i$$$ to all such indices $$$j$$$ that $$$t_j > t_i$$$ (consider that 'a'<'b'<...<'z'). In other words, to calculate $$$b_i$$$, Polycarp finds all such indices $$$j$$$ that the index $$$j$$$ contains a letter that is later in the alphabet than $$$t_i$$$ and sums all the values $$$|i-j|$$$.For example, if $$$t$$$ = "abzb", then:  since $$$t_1$$$='a', all other indices contain letters which are later in the alphabet, that is: $$$b_1=|1-2|+|1-3|+|1-4|=1+2+3=6$$$;  since $$$t_2$$$='b', only the index $$$j=3$$$ contains the letter, which is later in the alphabet, that is: $$$b_2=|2-3|=1$$$;  since $$$t_3$$$='z', then there are no indexes $$$j$$$ such that $$$t_j>t_i$$$, thus $$$b_3=0$$$;  since $$$t_4$$$='b', only the index $$$j=3$$$ contains the letter, which is later in the alphabet, that is: $$$b_4=|4-3|=1$$$. Thus, if $$$t$$$ = "abzb", then $$$b=[6,1,0,1]$$$.Given the string $$$s$$$ and the array $$$b$$$, find any possible string $$$t$$$ for which the following two requirements are fulfilled simultaneously:  $$$t$$$ is obtained from $$$s$$$ by erasing some letters (possibly zero) and then writing the rest in any order;  the array, constructed from the string $$$t$$$ according to the rules above, equals to the array $$$b$$$ specified in the input data.

The first line contains an integer $$$q$$$ ($$$1 \le q \le 100$$$) — the number of test cases in the test. Then $$$q$$$ test cases follow. Each test case consists of three lines:   the first line contains string $$$s$$$, which has a length from $$$1$$$ to $$$50$$$ and consists of lowercase English letters;  the second line contains positive integer $$$m$$$ ($$$1 \le m \le |s|$$$), where $$$|s|$$$ is the length of the string $$$s$$$, and $$$m$$$ is the length of the array $$$b$$$;  the third line contains the integers $$$b_1, b_2, \dots, b_m$$$ ($$$0 \le b_i \le 1225$$$).  It is guaranteed that in each test case an answer exists.

Output $$$q$$$ lines: the $$$k$$$-th of them should contain the answer (string $$$t$$$) to the $$$k$$$-th test case. It is guaranteed that an answer to each test case exists. If there are several answers, output any.

NoteIn the first test case, such strings $$$t$$$ are suitable: "aac', "aab".In the second test case, such trings $$$t$$$ are suitable: "a", "b", "c".In the third test case, only the string $$$t$$$ equals to "aba" is suitable, but the character 'b' can be from the second or third position.

var abc = [];
for (var i = 'a'.charCodeAt(0); i <= 'z'.charCodeAt(0); i++) {
   abc.push(String.fromCharCode(i));
}
var n = abc.length;

function solve() {
   var T = Number(read());
   for (var t = 0; t < T; ++t) {
      var s = read();
      var m = Number(read());
      var b = read().split(' ').map(Number);
      var lettersCount = {};
      for (var i = 0; i < s.length; ++i) {
         if (!lettersCount[s[i]]) {
            lettersCount[s[i]] = 0;
         }
         lettersCount[s[i]]++;
      }
      var j = n - 1;
      while (true) {
         var counter = 0;
         var indexes = [];
         for (var i = 0; i < m; ++i) {
            if (b[i] === 0) {
               counter++;
               indexes.push(i);
            }
         }
         if (!counter) {
            break;
         }
         while (!lettersCount[abc[j]] || lettersCount[abc[j]] < counter) {
            j--;
         }
         for (var i = 0; i < m; ++i) {
            if (typeof b[i] === 'string') {
               continue;
            }
            if (b[i] === 0) {
               b[i] = abc[j];
               continue;
            }
            for (var k = 0; k < indexes.length; ++k) {
               b[i] -= Math.abs(i - indexes[k]);
            }
         }
         j--;
      }
      write(b.join(''));
   }
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         solve();
      });
   } else {
      var RL = require('readline').createInterface({
         input : process.stdin,
         output : process.stdout
      });

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

      RL.on('close', solve);
   }
} else {
   solve();
}

function write(value) {
   isNode ? console.log(value) : print(value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}


Ichihime is the current priestess of the Mahjong Soul Temple. She claims to be human, despite her cat ears.These days the temple is holding a math contest. Usually, Ichihime lacks interest in these things, but this time the prize for the winner is her favorite — cookies. Ichihime decides to attend the contest. Now she is solving the following problem. You are given four positive integers $$$a$$$, $$$b$$$, $$$c$$$, $$$d$$$, such that $$$a \leq b \leq c \leq d$$$. Your task is to find three integers $$$x$$$, $$$y$$$, $$$z$$$, satisfying the following conditions: $$$a \leq x \leq b$$$. $$$b \leq y \leq c$$$. $$$c \leq z \leq d$$$. There exists a triangle with a positive non-zero area and the lengths of its three sides are $$$x$$$, $$$y$$$, and $$$z$$$.Ichihime desires to get the cookie, but the problem seems too hard for her. Can you help her?

The first line contains a single integer $$$t$$$ ($$$1 \leq t \leq 1000$$$)  — the number of test cases. The next $$$t$$$ lines describe test cases. Each test case is given as four space-separated integers $$$a$$$, $$$b$$$, $$$c$$$, $$$d$$$ ($$$1 \leq a \leq b \leq c \leq d \leq 10^9$$$).

For each test case, print three integers $$$x$$$, $$$y$$$, $$$z$$$  — the integers you found satisfying the conditions given in the statement. It is guaranteed that the answer always exists. If there are multiple answers, print any.

NoteOne of the possible solutions to the first test case:One of the possible solutions to the second test case:

const readline = require('readline');
let inputs = [];
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
rl.on('line', lineInput => {
    inputs.push(lineInput);
});

rl.on('close', () => {
	const test = parseInt(inputs[0]);
	let n = [];
	for (let t = 0; t < test; t++) {
		n = inputs[t+1].split(' ').map((a) => {return parseInt(a)});
    	console.log(solution(n));
	}
});

function solution(n) {
	let i = 0, j = 0, k = 0;
	let a = n[0], b = n[1], c = n[2], d = n[3];
	return `${b} ${c} ${c}`
}

'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 cases = readline();
    var i;
    for (i = 0; i < cases; i++) {
        const line = readline();
        var a = parseInt(line.split(" ")[0]);
        var b = parseInt(line.split(" ")[1]);
        var c = parseInt(line.split(" ")[2]);
        var d = parseInt(line.split(" ")[3]);

        solve(a, b, c, d);
    }
}

function solve(a, b, c, d) {
    console.log (b + " " + c + " " + c);
}

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

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

  const [a, b, c, d] = data.split(' ').map(Number);
  console.log(b, c, c);

  count++;
});

const processData = (input) => {
    let exp = /\s+/;
    let arr = input.split(exp);
    let l = arr[0];
    arr = arr.slice(1);
    arr = arr.map(el => +el);
    for (let z = 0; z < l; z ++){
        a = arr[0];
        c = arr[2];
        console.log(`${a} ${c} ${c}`)
        arr = arr.slice(4);
    }
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
    processData(_input);
});

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    var x2 = true;
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    var x4 = true;
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    var x3 = true;
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var j = parseInt(readline());
    var x4 = true;
    for (var _ = 0; _ < j; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    var x = true;
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

"use strict";
exports.__esModule = true;
var str = "", lines = [], idxLine = 0;
process.stdin.resume();
process.stdin.setEncoding('utf-8');
process.stdin.on('data', function (x) { str += x; });
process.stdin.on('end', function () {
    lines = str.trim().split('\n').map(function (x) { return x.trim(); });
    main();
});
function readline() {
    return lines[idxLine++];
}
var print = console.log;
//===============================
//===============================
function main() {
    var t = parseInt(readline());
    var x5 = true;
    for (var _ = 0; _ < t; _++) {
        var _a = readline().split(' ').map(function (e) { return parseInt(e); }), a = _a[0], b = _a[1], c = _a[2], d = _a[3];
        print(b, c, c);
    }
}

const processData = (lines) => {
  const n = +lines[0]
  for (let i=0; i<n; i++) {
    const [a, b, c, d] = lines[i+1].split(' ').map(x => +x)
    console.log(b, c, c)
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

// Sample code to perform I/O:

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

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

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

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

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

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

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

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();

    for (let index = 1; index <= t; index++) {
        const element = strToNumArr(inputs[index].trim().split(' '));
        let str = '';
        for (let index2 = 1; index2 <= element.length; index2++) {
            if (index2 - 1 == 2) {
                str += element[index2 - 1] + ' ';
            }
            else if (element[index2 - 1] <= element[index2]) {
                str += element[index2] + ' ';
            }
        }
        console.log(str.trim());
    }
}

'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 checkValidity(a, b, c) {
  if ((a + b <= c) || (a + c <= b) || (b + c <= a)) {
    return false;
  } else {
    return true;
  }
}

function main() {
  let X = parseInt(readline());
  for (var cases = 0; cases < X; cases++) {
    const [a,b,c,d] = readline().split(" ").map(e => parseInt(e));

    //console.log(a,b,c,d);
    //console.log(checkValidity(b,c, c));
    console.log(b,c,c);

     //console.log(c-b);
  }
}

var testcase=parseInt(readline());
while(testcase--){
    var x=readline().split(' ').map(x=>parseInt(x));
    var a=x[0];
    var b=x[1];
    var c=x[2];
    print(b,c,c);
}

for(var t=Number(readline());t;t--){
 var a = readline().trim().split(/\s/).map(x=>Number(x));
 print("" + a[1] + " " + a[2] + " " + a[2]);
}

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

var T = parseInt(readline());
while (T--) {
    var input1 = readline().split(' ').map(x => parseInt(x));
    var a = input1[0]
    var b = input1[1]
    var c = input1[2]
    print(a, c, c)
}

var range = readline();

for(var i=0;i<range;i++) {
    var inputs = readline().split(" ").map((x) => parseInt(x));
    var firstSet = inputs[0];
    var secondSet = inputs[1];
    var thirdSet = inputs[2];
    var fourthSet = inputs[3];

    var oneSide = 1;
    var secondSide = 1;
    var thirdSide = 1;

    oneSide = Math.min(firstSet, secondSet);
    secondSide = Math.max(secondSet, thirdSet);
    thirdSide = Math.min(thirdSet, fourthSet);

    while(oneSide <= secondSide && secondSide <= thirdSide) {
        if(oneSide + secondSide > thirdSide && thirdSide + oneSide > secondSide && secondSide + thirdSide > oneSide) {
            print(oneSide, secondSide, thirdSide);
            break;
        } else {
            oneSide++;
            secondSide--;
            thirdSide++;
        }
    }
}

'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 cases = readline();
    var i;
    for (i = 0; i < cases; i++) {
        const line = readline();
        var a = parseInt(line.split(" ")[0]);
        var b = parseInt(line.split(" ")[1]);
        var c = parseInt(line.split(" ")[2]);
        var d = parseInt(line.split(" ")[3]);

        solve(a, b, c, d);
    }
}

function solve(a, b, c, d) {
    console.log (b + " " + c + " " + d);
}

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

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

  const arr = d.split(' ');
  arr.pop();
  console.log(arr.join(' '));

  c++;
});

const processData = (input) => {
    let exp = /\s+/;
    let arr = input.split(exp);
    let l = arr[0];
    arr = arr.slice(1);
    arr = arr.map(el => +el);
    for (let z = 0; z < l; z ++){
        a = arr[0];
        d = arr[3];
        console.log(`${a} ${d} ${d}`)
        arr = arr.slice(4);
    }
}

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
    processData(_input);
});

const processData = (lines) => {
  const n = +lines[0]
  for (let i=0; i<n; i++) {
    const [a, b, c, d] = lines[i+1].split(' ').map(x => +x)
    console.log(b, c, d)
  }
}

let i = ''
process.stdin.on('data', c => i += c)
process.stdin.on('end', () => {
  const {EOL} = require('os')
  const lines = i.split(EOL) /*your input text, split by lines*/
  processData(lines)
})

// Sample code to perform I/O:

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

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

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

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

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

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

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

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();

    for (let index = 1; index <= t; index++) {
        const element = strToNumArr(inputs[index].trim().split(' '));
        let str = '';
        for (let index2 = 1; index2 <= element.length; index2++) {

            if (element[index2 - 1] <= element[index2]) {
                str += element[index2 - 1] + ' ';
            }
        }
        console.log(str.trim());
    }
}

// Sample code to perform I/O:

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

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

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

/**
 *
 * @param {*} str
 * @param {*} seperator
 */
function splitter(str, seperator = '') {
    return str.trim().split(seperator);
}

/**
 *
 * @param {*} arr
 */
function strToNumArr(arr = []) {
    return arr.map(num => Number(num));
}

/**
 *
 * @param {*} num1
 * @param {*} num2
 */
function matrixArray(num1, num2) {
    return Array(num1).fill(Array(num2));
}

let log = function () {
    return Function.prototype.bind.call(console.log, console, '');
}();

function removeEmptyItem(arr, index) {
    return arr.slice(0, index).concat(arr.slice(index + 1, arr.length));
}

function range(min, max) {

    let arr = [];
    for (let index = min; index < max; index++) {
        arr.push(index);

    }
    return arr;
}

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

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

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

    let inputs = str.trim().split('\n');
    let t = +inputs[0].trim();

    for (let index = 1; index <= t; index++) {
        const element = strToNumArr(inputs[index].trim().split(' '));
        let str = '';
        for (let index2 = 1; index2 <= element.length; index2++) {
            if (element[index2 - 1] <= element[index2]) {
                str += element[index2] + ' ';
            }
        }
        console.log(str.trim());
    }
}

var T = parseInt(readline());
while (T--) {
    var input1 = readline().split(' ').map(x => parseInt(x));
    input1.sort((x, y) => x - y)
    input1.splice(0, 1)
    print(input1.join(" "))
}

var T = parseInt(readline());
while (T--) {
    var input1 = readline().split(' ').map(x => parseInt(x));
    var a = input1[0]
    var b = input1[1]
    var c = input1[2]
    print(a, b, c)
}

var range = readline();

for(var i=0;i<range;i++) {
    var inputs = readline().split(" ").map((x) => parseInt(x));
    var firstSet = inputs[0];
    var secondSet = inputs[1];
    var thirdSet = inputs[2];
    var fourthSet = inputs[3];
    var secondSide = inputs[1];

    var oneSide = Math.floor((secondSet + thirdSet) / 2);
    if(oneSide < secondSet) {
        secondSide = Math.floor((firstSet + oneSide) / 2);
    }
    var thirdSide = Math.floor((secondSide + fourthSet) / 2);

    while(oneSide + secondSide < thirdSide) {
        secondSide ++;
        oneSide++;
    }

    while(thirdSide + secondSide < oneSide) {
        thirdSide ++;
        secondSide++;
    }

    print(secondSide, oneSide, thirdSide);

}

var range = readline();

for(var i=0;i<range;i++) {
    var inputs = readline().split(" ").map((x) => parseInt(x));
    var firstSet = inputs[0];
    var secondSet = inputs[1];
    var thirdSet = inputs[2];
    var fourthSet = inputs[3];

    var secondSide = inputs[1];

    var oneSide = Math.floor((secondSet + thirdSet) / 2);
    if(oneSide < secondSet) {
        secondSide = Math.floor((firstSet + oneSide) / 2);
    }
    var thirdSide = Math.floor((secondSide + fourthSet) / 2);

        while(oneSide + secondSide < thirdSide) {
        secondSide ++;
        oneSide++;
    }

    while(thirdSide + secondSide < oneSide) {
        thirdSide ++;
        secondSide++;
    }

    if(fourthSet === thirdSet) {
        thirdSide = thirdSet;
    }

    if(secondSet === thirdSet) {
        oneSide = thirdSet;
    }

    if(firstSet === secondSet) {
        secondSide = firstSet;
    }

    print(secondSide, oneSide, thirdSide);

}