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.*;

public class A implements Runnable {

    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    private void init() throws FileNotFoundException {
        Locale.setDefault(Locale.US);
        String fileName = "";
        if (ONLINE_JUDGE && fileName.isEmpty()) {
            in = new BufferedReader(new InputStreamReader(System.in), 32768);
            out = new PrintWriter(System.out);
        } else {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }
        }
    }

    String readString() {
        while (!tok.hasMoreTokens()) {
            try {
                tok = new StringTokenizer(in.readLine());
            } catch (Exception e) {
                return null;
            }
        }
        return tok.nextToken();
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    int[] readIntArray(int size) {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = readInt();
        }
        return a;
    }

    public static void main(String[] args) {
        //new Thread(null, new _Solution(), "", 128 * (1L << 20)).start();
        new A().run();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    @Override
    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            time();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    boolean isValid(int x, int y) {
        return x >= 0 && x < 13 && y >= 0 && y < 2;
    }

    int[] getTo(int x, int y) {
        int toX, toY;
        if (y == 0) {
            toX = x + 1;
            toY = y;
            if (!isValid(toX, toY)) {
                toX = x;
                toY = 1;
            }
        } else {
            toX = x - 1;
            toY = y;
            if (!isValid(toX, toY)) {
                toX = x;
                toY = 0;
            }
        }
        return new int[]{toX, toY};
    }

    private void solve() throws IOException {
        char[] s = readString().toCharArray();
        int n = s.length;

        for (int start = 0; start < 13; start++) {
            char[][] answer = new char[13][2];
            int x = start, y = 0;
            int[] count = new int['Z' + 1];
            boolean correct = true;
            for (int i = 0; i < n; i++) {
                if (count[s[i]] == 1) {
                    boolean find = false;
                    for (int dx = -1; dx <= 1; dx++) {
                        for (int dy = -1; dy <= 1; dy++) {
                            if (dx != 0 || dy != 0) {
                                if (isValid(x + dx, y + dy)) {
                                    if (answer[x + dx][y + dy] == s[i]) {
                                        int[] tos = getTo(x, y);
                                        if (Math.abs(tos[0] - (x + dx)) <= 1 && Math.abs(tos[1] - (y + dy)) <= 1) {
                                            find = true;
                                        } else {
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!find) {
                        correct = false;
                        break;
                    }
                } else {
                    count[s[i]]++;
                    if (y == 0) {
                        int toX = x + 1;
                        int toY = y;
                        if (!isValid(toX, toY)) {
                            toX = x;
                            toY = 1;
                        }
                        answer[toX][toY] = s[i];
                        x = toX;
                        y = toY;
                    } else {
                        int toX = x - 1;
                        int toY = y;
                        if (!isValid(toX, toY)) {
                            toX = x;
                            toY = 0;
                        }
                        answer[toX][toY] = s[i];
                        x = toX;
                        y = toY;
                    }
                }
            }
            if (correct) {
                print(answer);
                return;
            }
        }

        for (int start = 0; start < 13; start++) {
            char[][] answer = new char[13][2];
            int x = start, y = 1;
            int[] count = new int['Z' + 1];
            boolean correct = true;
            for (int i = 0; i < n; i++) {
                if (count[s[i]] == 1) {
                    boolean find = false;
                    for (int dx = -1; dx <= 1; dx++) {
                        for (int dy = -1; dy <= 1; dy++) {
                            if (dx != 0 || dy != 0) {
                                if (isValid(x + dx, y + dy)) {
                                    if (answer[x + dx][y + dy] == s[i]) {
                                        int[] tos = getTo(x, y);
                                        if (Math.abs(tos[0] - (x + dx)) <= 1 && Math.abs(tos[1] - (y + dy)) <= 1) {
                                            find = true;
                                        } else {
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!find) {
                        correct = false;
                        break;
                    }
                } else {
                    count[s[i]]++;
                    if (y == 0) {
                        int toX = x + 1;
                        int toY = y;
                        if (!isValid(toX, toY)) {
                            toX = x;
                            toY = 1;
                        }
                        answer[toX][toY] = s[i];
                        x = toX;
                        y = toY;
                    } else {
                        int toX = x - 1;
                        int toY = y;
                        if (!isValid(toX, toY)) {
                            toX = x;
                            toY = 0;
                        }
                        answer[toX][toY] = s[i];
                        x = toX;
                        y = toY;
                    }
                }
            }
            if (correct) {
                print(answer);
                return;
            }
        }

        out.println("Impossible");
    }

    private void print(char[][] answer) {
        for (int i = 0; i < 2; i++) {
            for (int j = 0; j < 13; j++) {
                out.print(answer[j][i]);
            }
            out.println();
        }
    }
}