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.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class CodeForcesC {

    private final static String FILENAME;
    private final static String PATH;
    static {
        FILENAME = "";
        if (!FILENAME.isEmpty()) {
            PATH = System.getProperty("user.home") + "/contests/" + FILENAME;
        } else {
            PATH = "";
        }
    }

    public static void main(String[] args) throws IOException {
        CodeForcesC solution = new CodeForcesC();
        solution.initInputReader();
        solution.solve();
        solution.cleanup();
    }

    private void solve() throws IOException {
        String s = nextString();
        int idx1 = 0, idx2 = 0;
        Map<Character, Integer> map = new HashMap<>();
        char dup = '\0';

        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (map.containsKey(c)) {
                idx1 = map.get(c);
                idx2 = i;
                dup = c;
                break;
            } else {
                map.put(c, i);
            }
        }
        int gap = idx2 - idx1 - 1;

        if (gap == 0) {
            System.out.println("Impossible");
            return;
        }

        char[][] grid = new char[2][13];
        Coord coord = new Coord();
        coord.y = 0;
        coord.x = 12 - (gap / 2);

        grid[coord.y][coord.x] = dup;
        moveCoord(coord);
        int idx = idx1 + 1;

        for (;;) {
            if (idx == idx1)
                break;

            char c = s.charAt(idx++);
            if (idx == s.length())
                idx = 0;
            if (c == dup)
                continue;

            grid[coord.y][coord.x] = c;
            moveCoord(coord);
        }

        System.out.println(new String(grid[0]));
        System.out.println(new String(grid[1]));
    }

    class Coord {
        int x;
        int y;
    }

    private void moveCoord(Coord c) {
        if (c.y == 0) {
            c.x++;

            if (c.x == 13) {
                c.y = 1;
                c.x = 12;
            }
        } else {
            c.x--;

            if (c.x == -1) {
                c.y = 0;
                c.x = 0;
            }
        }
    }

    private final static int MOD = 1000000007;

    /*
     * Methods for reading input
     */

    private BufferedReader br;
    private StringTokenizer st;

    private void initInputReader() throws IOException {
        if (FILENAME.isEmpty()) {
            br = new BufferedReader(new InputStreamReader(System.in));
        } else {
            br = new BufferedReader(new FileReader(new File(PATH)));
        }
        st = new StringTokenizer(br.readLine());
    }

    private void cleanup() throws IOException {
        br.close();
    }

    private int nextInt() throws IOException {
        checkEmptyTokenizer();
        return Integer.parseInt(st.nextToken());
    }

    private long nextLong() throws IOException {
        checkEmptyTokenizer();
        return Long.parseLong(st.nextToken());
    }

    private double nextDouble() throws IOException {
        checkEmptyTokenizer();
        return Double.parseDouble(st.nextToken());
    }

    private String nextString() throws IOException {
        checkEmptyTokenizer();
        return st.nextToken();
    }

    private void checkEmptyTokenizer() throws IOException {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
    }

    /*
     * Convenience methods
     */

    // Provides a default value if map doesn't have the key
    private <K, V> V getFromMap(Map<K, V> map, K key, V def) {
        if (map.containsKey(key)) {
            return map.get(key);
        }
        return def;
    }

    private void print(String line, Object... args) {
        System.out.println(String.format(line, args));
    }
}