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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.Set;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Ranis Nigmatullin - Kazan FU #4.1 [Ranis]
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        int pi;
        int pj;

        void move() {
            if (pi == 0) {
                if (pj < 12) {
                    pj++;
                    return;
                } else {
                    pj = 12;
                    pi = 1;
                }
            } else {
                if (pj > 0) {
                    pj--;
                    return;
                } else {
                    pj = 0;
                    pi = 0;
                    return;
                }
            }
        }

        char findFirstPosition(String s) {
            Set<Character> used = new TreeSet<>();
            for (char c : s.toCharArray()) {
                if (used.contains(c)) {
                    return c;
                } else {
                    used.add(c);
                }
            }
            return '#';
        }

        IntIntPair boolbool(String s, char c) {
            int i = -1, j = -1;
            for (int at = 0; at < s.length(); at++) {
                if (s.charAt(at) == c) {
                    if (i == -1) {
                        i = at;
                    } else {
                        j = at;
                    }
                }
            }
            return new IntIntPair(i, j);
        }

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            String s = in.next();
            for (int i = 0; i < s.length() - 1; i++) {
                if (s.charAt(i) == s.charAt(i + 1)) {
                    out.print("Impossible");
                    return;
                }
            }
            char symbol = findFirstPosition(s);
            IntIntPair poss = boolbool(s, symbol);
            int c = poss.second - poss.first - 1;
            int top = c / 2;
            char[][] result = new char[2][13];
            int cPosition = 13 - top - 1;
            result[0][cPosition] = symbol;
            int indexOfStr = poss.first + 1;
            for (int i = cPosition + 1; i < 13; i++, indexOfStr++) {
                result[0][i] = s.charAt(indexOfStr);
            }
            int down = c - top;
            int last = 0;
            for (int i = 12; i >= 0 && down > 0; i--, indexOfStr++, down--) {
                result[1][i] = s.charAt(indexOfStr);
                last = i;
            }
            indexOfStr = poss.second + 1;
            pi = 1;
            pj = last - 1;
            while (indexOfStr < s.length()) {
                result[pi][pj] = s.charAt(indexOfStr);
                move();
                indexOfStr++;
            }
            indexOfStr = 0;
            while (indexOfStr < poss.first) {
                result[pi][pj] = s.charAt(indexOfStr);
                move();
                indexOfStr++;
            }
            for (int i = 0; i < 2; i++) {
                for (int j = 0; j < 13; j++) {
                    out.print(result[i][j]);
                }
                out.printLine();
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine() {
            writer.println();
        }

        public void print(char i) {
            writer.print(i);
        }

        public void close() {
            writer.close();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class IntIntPair implements Comparable<IntIntPair> {
        public final int first;
        public final int second;

        public IntIntPair(int first, int second) {
            this.first = first;
            this.second = second;
        }

        public String toString() {
            return "(" + first + "," + second + ")";
        }

        @SuppressWarnings({"unchecked"})
        public int compareTo(IntIntPair o) {
            int value = Integer.compare(first, o.first);
            if (value != 0) {
                return value;
            }
            return Integer.compare(second, o.second);
        }

    }
}