// Arup Guha
// 2/9/2022
// Solution to COP 3503 Exam #1 Question #3

import java.util.*;

public class whichperm {

	public static int n;
	public static String input;
	
	public static void main(String[] args) {
	
		// Read input.
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		input = stdin.next();
		
		// Set up recursion and call it.
		int[] perm = new int[n];
		boolean[] used = new boolean[n+1];
		boolean res = go(perm, used, 0, 0);
		
		// Pritn result.
		for (int i=0; i<n-1; i++)
			System.out.print(perm[i]+", ");
		System.out.println(perm[n-1]);
	}
	
	// Just like Tentaizu we return true if a solution with the first k items of perm
	// exists and false otherwise. strIdx represents our current index into the string input.
	public static boolean go(int[] perm, boolean[] used, int k, int strIdx) {
	
		// We made it.
		if (k == n) return true;
		
		// If our next number is one digit, this is what it would be.
		int oneD = input.charAt(strIdx) - '0';
		
		// 0 isn't allowed.
		if (oneD == 0) return false;
		
		// If we haven't used it, and it's not too big, try oneD in slot k.
		if (oneD <= n && !used[oneD]) {
			
			// Add to perm and mark it.
			used[oneD] = true;
			perm[k] = oneD;
			
			// See if this works, if so, just return true.
			boolean tmp = go(perm, used, k+1, strIdx+1);
			if (tmp) return true;
			
			// If we get here, that didn't work.
			used[oneD] = false;
		}
		
		// This means that there is no two digit number to split off.
		if (strIdx+1 == input.length()) return false;
		
		// Safe to calculate this.
		int twoD = 10*(oneD) + (input.charAt(strIdx+1)-'0');
		
		// Same deal - this is only an option if it's not used and not too big,
		if (twoD <= n && !used[twoD]) {
			used[twoD] = true;
			perm[k] = twoD;
			boolean tmp = go(perm, used, k+1, strIdx+2);
			if (tmp) return true;
			used[twoD] = false;
		}
		
		// If we get here, we can't do it.
		return false;
	}
}