Problem: Let’s define a grid to be a set of tiles with 2 rows and 13 columns. Each tile has an English letter written in it. The letters don't have to be unique: there might be two or more tiles with the same letter written on them. Here is an example of a grid:
    
    
    ABCDEFGHIJKLM  
    NOPQRSTUVWXYZ

We say that two tiles are adjacent if they share a side or a corner. In the example grid above, the tile with the letter 'A' is adjacent only to the tiles with letters 'B', 'N', and 'O'. A tile is not adjacent to itself.

A sequence of tiles is called a path if each tile in the sequence is adjacent to the tile which follows it (except for the last tile in the sequence, which of course has no successor). In this example, "ABC" is a path, and so is "KXWIHIJK". "MAB" is not a path because 'M' is not adjacent to 'A'. A single tile can be used more than once by a path (though the tile cannot occupy two consecutive places in the path because no tile is adjacent to itself).

You’re given a string s which consists of 27 upper-case English letters. Each English letter occurs at least once in s. Find a grid that contains a path whose tiles, viewed in the order that the path visits them, form the string s. If there’s no solution, print "Impossible" (without the quotes).

Input

The only line of the input contains the string s, consisting of 27 upper-case English letters. Each English letter occurs at least once in s.

Output

Output two lines, each consisting of 13 upper-case English characters, representing the rows of the grid. If there are multiple solutions, print any of them. If there is no solution print "Impossible".

Examples

Input

ABCDEFGHIJKLMNOPQRSGTUVWXYZ


Output

YXWVUTGHIJKLM
ZABCDEFSRQPON


Input

BUVTYZFQSNRIWOXXGJLKACPEMDH


Output

Impossible

Solution (in JAVA):

Solution:
import java.util.ArrayList;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CanadaC {
    public static ArrayList<String> singleChar = new ArrayList<String>();
    public static int n;
    public static int m;
    public static void main(String[] args){
        initializeSingleChar();
        Scanner scanner =  new Scanner(System.in);

        String input = scanner.nextLine();
        int[] poses = findPair(input);
        int LENGTH = 13;
        int pos1 = poses[0];
        int pos2 = poses[1];
        if (pos1 == -1 && pos2 == -1) {
            System.out.println ("Impossible");
            return;
        }
        int midRange = 0;
        if ((pos2-pos1) % 2 == 1) midRange = (pos2 - pos1)/2 + 1;
        else midRange = (pos2 -pos1)/2;

        char[] row1 =  new char [13];
        char[] row2  = new char[13];

        /*
         * Contruct characters between pair
         */
        row1[LENGTH-midRange] = input.charAt(pos1);
        int count = 1;
        int c = pos1 + count;
        for (int i = LENGTH-midRange + 1 ; i < LENGTH ; i++){
            row1[i] = input.charAt(c);
            count++;
            c++;
        }
        int p = LENGTH -1;
        while (c < pos2){
            row2[p] = input.charAt(c);
            c++;
            p--;
        }
        int temp = pos2 + 1;
        int temp2 = LENGTH - midRange -1 ;
        while (temp < input.length() && temp2 >= 0){
            row1[temp2] = input.charAt(temp);
            temp++;
            temp2--;
        }

        if (temp == input.length()){                //END OF INPUT
                int tt = 0;
                while (temp2 >= 0 ){
                    row1[temp2] = input.charAt(tt);
                    tt++;
                    temp2--;
                }
                int ttt = 0 ;
                while (tt < pos1){
                    row2[ttt] = input.charAt(tt);
                    ttt++;
                    tt++;
                }
        }else if (temp2 < 0 ){
            int t = 0;
            while (temp < input.length()){
                row2[t] = input.charAt(temp);
                temp++;
                t++;
            }
            int tt = 0;
            for (tt = 0 ; tt < pos1; tt++){
                row2[t] = input.charAt(tt);
                t++;
            }
        }
        for (int i = 0 ; i < LENGTH ; i++){
            System.out.print(row1[i]);
        }
        System.out.println();
        for (int i = 0 ; i < LENGTH ; i++){
            System.out.print(row2[i]);
        }
        System.out.println();
    }
    public static void initializeSingleChar() {
        singleChar.add("A");singleChar.add("B");singleChar.add("C");singleChar.add("D");singleChar.add("E");singleChar.add("F");
        singleChar.add("G");singleChar.add("H");singleChar.add("I");singleChar.add("J");singleChar.add("K");singleChar.add("L");
        singleChar.add("M");singleChar.add("N");singleChar.add("O");singleChar.add("P");singleChar.add("Q");singleChar.add("R");
        singleChar.add("S");singleChar.add("T");singleChar.add("U");singleChar.add("V");singleChar.add("W");singleChar.add("X");
        singleChar.add("Y");singleChar.add("Z");
    }
    public static int[] findPair(String str) {
        int[] output = new int[2];
        for (String c : singleChar) {
            String regex = c + "[A-Z]+" + c;
            if (isMatches(str, regex)) {
                output[0] = str.indexOf(c);
                output[1] = output[0] + 2 + str.substring(output[0] + 2).indexOf(c);
                return output;
            }
        }
        output[0] = -1;
        output[1] = -1;
        return output;

    }
    public static boolean isMatches(String text, String regex) {
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(text);
        // Check all occurrences
        if (matcher.find()) {
            return true;
        }
        return false;
    }


}