import java.util.*;

public class Solution {
    public String PrintMinNumber(int [] numbers) {
        String[] str = new String[numbers.length];
        for(int i = 0; i < numbers.length; i++){
            str[i] = String.valueOf(numbers[i]);
        }

        Arrays.sort(str,(a,b)->{
                List<Integer> aList = convert(a);
                List<Integer> bList = convert(b);
                int i = 0, j = 0;
                while(i < aList.size() || j < bList.size()){
                    int at = i < aList.size() ? aList.get(i) : aList.get(aList.size()-1);
                    int bt = j < bList.size() ? bList.get(i) : bList.get(bList.size()-1);
                    if(at != bt){
                        return at - bt;
                    }
                    i++;
                    j++;
                }
                return 1;
        });
        String res = new String();
        for(String s : str){
           res += s;
        } 
        return res;
    }
    List<Integer> convert(String a){
        int ai = Integer.valueOf(a);
        List<Integer> list = new ArrayList<>();
        while(ai > 0){
            list.add(ai % 10);
            ai /= 10;
        }
        Collections.reverse(list);
        return list;
    }
}