/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
static void selectionSort(int []x){
for (int i = 0; i < x.length-1; i++) {
int mn=i;
for (int j = i+1; j < x.length; j++) {
if(x[mn]>x[j]){
mn=j;
}
}
int temp=x[i];
x[i]=x[mn];
x[mn]=temp;
}
}
static void BubbleSort(int []x){
boolean swap=true;
for (int i = 0; i < x.length; i++) {
for (int j = 0; j < x.length-1; j++) {
if(x[j]>x[j+1]){
int temp=x[i];
x[i]=x[j];
x[j]=temp;
swap=false;
}
}
if(swap){
break;
}
}
}
{
// your code goes here
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCSAgICBzdGF0aWMgICB2b2lkIHNlbGVjdGlvblNvcnQoaW50IFtdeCl7CiAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPCB4Lmxlbmd0aC0xOyBpKyspIHsKICAgICAgICAgICAgaW50IG1uPWk7CiAgICAgICAgICAgIGZvciAoaW50IGogPSBpKzE7IGogPCB4Lmxlbmd0aDsgaisrKSB7CiAgICAgICAgICAgICAgICBpZih4W21uXT54W2pdKXsKICAgICAgICAgICAgICAgICAgICBtbj1qOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIGludCB0ZW1wPXhbaV07CiAgICAgICAgICAgIHhbaV09eFttbl07CiAgICAgICAgICAgIHhbbW5dPXRlbXA7CiAgICAgICAgfQogICAgfQogICAgc3RhdGljIHZvaWQgQnViYmxlU29ydChpbnQgW114KXsKICAgICAgICBib29sZWFuIHN3YXA9dHJ1ZTsKICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IHgubGVuZ3RoOyBpKyspIHsKICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCB4Lmxlbmd0aC0xOyBqKyspIHsKICAgICAgICAgICAgICAgIGlmKHhbal0+eFtqKzFdKXsKICAgICAgICAgICAgICAgICAgICBpbnQgdGVtcD14W2ldOwogICAgICAgICAgICAgICAgICAgIHhbaV09eFtqXTsKICAgICAgICAgICAgICAgICAgICB4W2pdPXRlbXA7CiAgICAgICAgICAgICAgICAgICAgc3dhcD1mYWxzZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQppZihzd2FwKXsKICAgIGJyZWFrOwp9CiAgICAgICAgfQogICAgfQoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpIHRocm93cyBqYXZhLmxhbmcuRXhjZXB0aW9uCgl7CgkJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJfQp9