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 CF725C{ 
  public static int index;
  public static void main(String[] args)throws Exception {
    InputReader in = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out));
    char []s = in.nextLine().toCharArray();
    
    int a = -1, b = -1;
    
    HashSet<Character> set = new HashSet<Character>();
    
    for(int i = 0; i < s.length; i++){
      if(!set.add(s[i])){
        b = i;
        for(int j = 0; j < i; j++){
          if(s[j] == s[i]){
            a = j;
            break;
          }
        }
        break;
      }
    }
    
    
    if(a == b-1){
      pw.println("Impossible");
    }
    
    else{
      
      //System.err.println(a+" "+b);
      
      Node[][] ans = new Node[2][13];
      boolean bol = false;
      
      for(int i = 0; i < 2; i++){
        for(int j = 0; j < 13; j++){
          build(ans, s, i, j, b);
          if(( b < 26 && check(ans, a, b-1)  && check(ans, a, b+1)) || (b == 26 &&check(ans, a, b-1) )){
            bol = true;
            break;
          }
          if(bol) break;
        }
        if(bol) break;
      }
    
      //System.err.println(bol);
      
      if(bol){
        for(int i = 0; i < 2; i++){
          for(int j = 0; j < 13; j++){
            pw.print(ans[i][j].c);
          }
          pw.println();
        }
      }
      
      else pw.println("Impossible");
    
    }
    pw.close();
  }
  
  
  static boolean isValid(int x, int y){
    return x >= 0 && x < 2 && y >= 0 && y < 13;
  }
      
  
  static boolean check(Node [][] ans, int a, int b){
    
    int dirx [] = {0, 1, 0, -1, 1, -1, 1, -1};
    int diry [] = {1, 0, -1, 0, -1, 1, 1, -1};
    
    for(int i = 0; i < 2; i++){
      for(int j = 0; j < 13; j++){
        for(int k = 0; k < 8; k++){
          int x = dirx[k]+i, y = diry[k]+j;
          if(isValid(x, y)){
            if(ans[i][j].i == a && ans[x][y].i == b) {
             // System.err.println(i+" xx "+j+" "+x+" "+y+" "+ans[i][j].c+" "+ans[x][y].c);
              return true;
            }
            if(ans[i][j].i == b && ans[x][y].i == a) {
              //System.err.println(i+" yy "+j+" "+x+" "+y+" "+ans[i][j].c+" "+ans[x][y].c);
              return true;
            }
          }
        }
      }
    }
    
    return false;
    
    
  }
      
  
  static void build(Node [][] ans, char[] s, int y, int x, int b){
    Arrays.fill(ans[0], null);
    Arrays.fill(ans[1], null);
    
    int c = 1;
    if(y == 1) c = -1;
    for(int i = 0; i < 27; i++){
      if(i == b) continue;
      if(x >= 13 && y == 0){
        y ^= 1;
        //x = 0;
        x = 12;
        if(c == 1) c = -1; else c = 1;
      }
      
      if(x < 0 && y == 1){
        y ^= 1;
        x = 0;
        if(c == 1) c = -1; else c = 1;
      }
      //System.err.println(y+" "+x+" "+i+" "+s[i]);
      ans[y][x] = new Node(s[i], i);
      x += c;
    }
    
    //System.err.println("done");
    
    for(int i = 0; i < 13; i++){
     
      if(ans[0][i] == null) ans[0][i]  = new Node('A', -1);
      if(ans[1][i] == null) ans[1][i]  = new Node('A', -1);   
    }


  }
  
  static class Node{
    public int i;
    public char c;
    public Node(char cc, int ii){
      c = cc; i = ii;
    }
  } 
  
  static class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;
    
    public InputReader(InputStream stream) {
      reader = new BufferedReader(new InputStreamReader(stream));
      tokenizer = null;
    }
    
    public String next()throws Exception {
      while (tokenizer == null || !tokenizer.hasMoreTokens())
        tokenizer = new StringTokenizer(reader.readLine());
      return tokenizer.nextToken();
    }
    
    public String nextLine()throws Exception {
      String line = null;
      tokenizer = null;
      line =  reader.readLine();
      return line;
    }
    
    public int nextInt()throws Exception {
      return Integer.parseInt(next());
    }
    
    public double nextDouble() throws Exception{
      return Double.parseDouble(next());
    }
    
    public long nextLong()throws Exception {
      return Long.parseLong(next());
    }
    
  }
}