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 Solution {
    private BufferedReader in;
    private StringTokenizer line;
    private PrintWriter out;
    private boolean isDebug;

    public Solution(boolean isDebug) {
        this.isDebug = isDebug;
    }

    private static final long mm = 1000000007;

    private long mult(long a, long b) {
        return a * b % mm;
    }

    private long pow(long a, long n) {
        if (n == 0) {
            return 1;
        }
        long t = pow(a, n / 2);
        t = mult(t, t);
        if (n % 2 != 0) {
            t = mult(t, a);
        }
        return t;
    }

    private void solve() throws IOException {
        char[] s = nextToken().toCharArray();
        int[] a = new int[26];
        int pos1 = 0;
        int pos2 = 0;
        for (int i = 0; i < s.length; i++) {
            if (a[s[i] - 'A'] > 0) {
                pos1 = a[s[i] - 'A'] - 1;
                pos2 = i;
                break;
            }
            a[s[i] - 'A'] = i + 1;
        }
        if (pos2 - pos1 == 1) {
            out.println("Impossible");
            return;
        }
        char[][] res = new char[2][13];
        int px = (pos2 - pos1 - 1) / 2;
        res[0][px] = s[pos1];
        if ((pos2 - pos1 - 1) % 2 == 0) {
            go(res, px - 1, 1, s, pos1 + 1, 1, pos2, new int[][]{{0, -1}, {-1, 0}, {0, 1}, {1, 0}});
        } else {
            go(res, px, 1, s, pos1 + 1, 1, pos2, new int[][]{{0, -1}, {-1, 0}, {0, 1}, {1, 0}});
        }
        if (pos1 > 0) {
            if (px + 1 < 13) {
                go(res, px + 1, 0, s, pos1 - 1, -1, -1, new int[][]{{0, 1}, {1, 0}, {0, -1}, {-1, 0}});
            }
            else{
                go(res, px, 1, s, pos1 - 1, -1, -1, new int[][]{{0, 1}, {1, 0}, {0, -1}, {-1, 0}});
            }
        }
        if (pos2 + 1 < s.length) {
            for (int i = 0; ; i++) {
                if (res[1][i] == 0) {
                    go(res, i, 1, s, pos2 + 1, 1, s.length, new int[][]{{0, 1}, {-1, 0}, {0, -1}, {1, 0}});
                    break;
                }
            }
        }
        out.println(new String(res[0]));
        out.println(new String(res[1]));
    }

    private void go(char[][] res, int y, int x, char[] s, int i, int di, int ilim, int[][] dxy) {
        res[x][y] = s[i];
        i += di;
        if (i == ilim) {
            return;
        }
        for (int j = 0; j < 4; j++) {
            int nx = x + dxy[j][0];
            int ny = y + dxy[j][1];
            if (nx >= 0 && nx <= 1 && ny >= 0 && ny <= 12 && res[nx][ny] == 0) {
                go(res, ny, nx, s, i, di, ilim, dxy);
                break;
            }
        }
    }

    public static void main(String[] args) throws IOException {
        new Solution(args.length > 0 && "DEBUG_MODE".equals(args[0])).run(args);
    }

    public void run(String[] args) throws IOException {
        if (isDebug) {
            in = new BufferedReader(new InputStreamReader(new FileInputStream("input.txt")));
        } else {
            in = new BufferedReader(new InputStreamReader(System.in));
        }
        out = new PrintWriter(System.out);
//        out = new PrintWriter("output.txt");

//        long start_time = System.nanoTime();

//        int t = nextInt();
        int t = 1;
//        int t = isDebug ? nextInt() : 1;
        for (int i = 0; i < t; i++) {
//            out.print("Case #" + (i + 1) + ": ");
            solve();
        }
//
//        long end_time = System.nanoTime();
//        if (isDebug) {
//            out.println(String.format("<<<<< %.6f >>>>>", (end_time - start_time) / 1e9));
//        }

        in.close();
        out.flush();
        out.close();
    }

    private int[] nextIntArray(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextInt();
        }
        return res;
    }

    private long[] nextLongArray(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nextLong();
        }
        return res;
    }

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

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

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

    private String nextToken() throws IOException {
        while (line == null || !line.hasMoreTokens()) {
            line = new StringTokenizer(in.readLine());
        }
        return line.nextToken();
    }

    private static class Pll {
        private long key;
        private long value;

        public Pll(long key, long value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pll pll = (Pll) o;

            if (key != pll.key) return false;
            return value == pll.value;

        }

        @Override
        public int hashCode() {
            int result = (int) (key ^ (key >>> 32));
            result = 31 * result + (int) (value ^ (value >>> 32));
            return result;
        }
    }

    private static class Pii {
        private int key;
        private int value;

        public Pii(int key, int value) {
            this.key = key;
            this.value = value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pii pii = (Pii) o;

            if (key != pii.key) return false;
            return value == pii.value;

        }

        @Override
        public int hashCode() {
            int result = key;
            result = 31 * result + value;
            return result;
        }

        @Override
        public String toString() {
            return "Pii{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }

    private static class Pair<K, V> {
        private K key;
        private V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;

            Pair<?, ?> pair = (Pair<?, ?>) o;

            if (key != null ? !key.equals(pair.key) : pair.key != null) return false;
            return !(value != null ? !value.equals(pair.value) : pair.value != null);

        }

        @Override
        public int hashCode() {
            int result = key != null ? key.hashCode() : 0;
            result = 31 * result + (value != null ? value.hashCode() : 0);
            return result;
        }

        @Override
        public String toString() {
            return "Pair{" +
                    "key=" + key +
                    ", value=" + value +
                    '}';
        }
    }
}