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.*;
import java.io.*;

public class C
{

    Reader in;
    PrintWriter out;
    int i = 0, j = 0;
    void solve()
    {
        
        //START// 
        //1:14
        String pa = in.next();
        char[] path = pa.toCharArray();
        int[] ind = new int[26];
        int leftInd = -1, rightInd = -1;
        Arrays.fill(ind, -1);
        StringBuilder topLine = new StringBuilder();
        StringBuilder botLine = new StringBuilder();
        char[][] sol = new char[2][13];
        for (i = 0; i < path.length; i++)
        {
            if (ind[path[i] - 'A'] == -1)
            {
                ind[path[i] - 'A'] = i;
            }
            else
            {
                leftInd = ind[path[i] - 'A'];
                rightInd = i;
            }
        }
        if (rightInd - leftInd == 1)
        {
            out.println("Impossible");
            return;
        }
        String middle = pa.substring(leftInd + 1, rightInd);
        if (middle.length() == 1)
        {
            topLine.append(path[leftInd]);
            botLine.append(middle);
        }
        else
        {
            topLine.append(getReverse(middle.substring(0, middle.length()/2)));
            topLine.append(path[leftInd]);
            botLine.append(middle.substring(middle.length()/2, middle.length()));
        }
        String pre = "";
        String post = "";
        if (leftInd > 0)
        {
            pre = getReverse(pa.substring(0, leftInd));
        }
        if (rightInd < 26)
        {
            post = pa.substring(rightInd+1, 27);
        }
        String excess = "";
        int cutoff = 13-topLine.length();
        if (pre.length() > post.length())
        {
            
            topLine.append(pre.substring(0, cutoff));
            excess = getReverse(pre.substring(cutoff, pre.length()));
            botLine.append(post);
            botLine.append(excess);
        }
        else
        {
            topLine.append(post.substring(0, cutoff));
            excess = getReverse(post.substring(cutoff, post.length()));
            botLine.append(pre);
            botLine.append(excess);
        }
        out.println(topLine.toString());
        out.println(botLine.toString());

        

        








        //END
        
    }
    String getReverse(String st)
    {
        StringBuilder r = new StringBuilder();
        for (int a = st.length()-1; a >= 0; a--)
        {
            r.append(st.charAt(a));
        }
        return r.toString();
    }
    void runIO()
    {
        in = new Reader();
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

    public static void main(String[] args)
    {
        new C().runIO();
    }


    // input/output
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        

        public final String next()
        {
            int c = read();
            while (isSpaceChar(c))
            {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do
            {
                res.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c)
        {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int nextInt()
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong()
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble()
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        public int[] readIntArray(int size)
        {
            int[] arr = new int[size];
            for (int i = 0; i < size; i++)
                arr[i] = nextInt();
            return arr;
        }

        public long[] readLongArray(int size)
        {
            long[] arr = new long[size];
            for (int i = 0; i < size; i++)
                arr[i] = nextInt();
            return arr;
        }

        private void fillBuffer()
        {
            try
            {
                bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            }
            catch (IOException e)
            {

            }
            
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read()
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }
    }
}