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.awt.Point;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.Comparator;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class Easy {
    static long mod = (long) (1e9 + 7);
    static int[] dx = {1,-1,0,0};
    static int[] dy = {0,0,1,-1};

    static int n;
    static int m;
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));
        String line  = sc.nextLine();
        char[][] grid = new char[2][13];
        HashMap<Character, Integer> ind = new HashMap<>();
        int span = -1;
        int startInd = -1;
        for (int i = 0; i < line.length(); i++) {
            if (ind.containsKey(line.charAt(i))) {
                span = i - ind.get(line.charAt(i)) - 1;
                startInd = ind.get(line.charAt(i));
            } else {
                ind.put(line.charAt(i), i);
            }
        }
        if (span == 0) {
            out.println("Impossible");
        } else {
            grid[0][12 - span/2] = line.charAt(startInd);
            int scol = 12 - span/2;
            for (int i = 1; i <= span; i++) {
                int temp = 12 - span/2 + i;
                if (temp >= 13) {
                    temp = 12 - (temp - 13);
                }
                grid[(scol + i)/13][temp] = line.charAt(startInd + i);
            }
            
            for (int i = 1; i <= 25 - span; i++) {
                int temp = scol - i;
                if (temp < 0) {
                    temp = (-1 * temp) - 1;
                }
                grid[scol - i < 0 ? 1 : 0][temp] = line.charAt((startInd + span + 1 + i) % 27);
            }
            for (int i = 0; i < grid.length; i++) {
                for (int j = 0; j < grid[i].length; j++) {
                    out.print(grid[i][j]);
                }
                out.println();
            }
        }
        
        out.close();
    }

    public static class Node {
        int gen;
        HashSet<Integer> edges;
        public Node() {
            edges = new HashSet<>();
            gen = -1000;
        }
    }

    public static class STree {
        long[] tree;
        long[] base;
        public STree(long[] base) {
            this.base = base;
            tree = new long[2 * base.length];
            for (int i = base.length; i < tree.length; i++) {
                tree[i] = base[i - base.length];
            }
            for (int i = base.length - 1; i > 0; i--) {
                tree[i] = tree[2*i] + tree[2*i ^ 1];
            }
        }

        public long get(int index) {
            return tree[index + base.length];
        }

        public void modify(int index, long val) {
            index += base.length;
            tree[index] = val;
            while (index > 1) {
                tree[index/2] = tree[index] + tree[index ^ 1];
                index/=2;
            }
        }

        public long query(int start, int end) {
            long ans = 0;
            start += base.length;
            end += base.length + 1;
            while (start < end) {
                if ((start & 1) == 1) {
                    ans += tree[start++];
                }
                if ((end & 1) == 1) {
                    ans += tree[--end];
                }
                start>>=1;
            end>>=1;
            }
            return ans;
        }

        public void print() {
            out.println();
            for (int i = base.length; i < tree.length; i++) {
                out.print(tree[i] + " ");
            }
            out.println();
        }
    }

    public static PrintWriter out;
    /*
    int n      = sc.nextInt();        // read input as integer
    long k     = sc.nextLong();       // read input as long
    double d   = sc.nextDouble();     // read input as double
    String str = sc.next();           // read input as String
    String s   = sc.nextLine();       // read whole line as String
    out.println(result);              // print via PrintWriter
     */
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}