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.lang.reflect.Array;
import java.math.BigInteger;
import java.text.Format;
import java.util.*;

public class A558 {
  static BufferedReader in = null;
  static PrintWriter out = null;
  static StringTokenizer st = new StringTokenizer("");
  static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") == null;

  public static void main(String[] args) {
    try {
      in = new BufferedReader(new InputStreamReader(System.in));
      out = new PrintWriter(System.out);
      solve();
      out.close();
      in.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public static String readString() {
    while (!st.hasMoreTokens()) {
      try {
        st = new StringTokenizer(in.readLine(), " \n");
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return st.nextToken();
  }

  private enum State {
    S, stateO, stateOn, stateOu, stateOut, stateOutp, stateOutpu, stateOutput, stateOoutputo, stateOutputon, stateP, statePu, statePut, statePuto, stateI, stateIn, stateInp, stateInpu, stateInput, stateInputo, stateInputon, stateOutputo, stateError
  }

  public static int readInt() {
    return Integer.parseInt(readString());
  }

  public static long readLong() {
    return Long.parseLong(readString());
  }

  public static double readDouble() {
    return Double.parseDouble(readString());
  }

  private static long binPow(long x, int step) {
    if (step == 0) return 1;
    if (step == 1) return x % mod;
    if (step % 2 == 0) {
      long temp = binPow(x, step / 2) % mod;
      return (temp * temp) % mod;
    }
    return (x * binPow(x, step - 1)) % mod;
  }

  private static int lcm(int x, int y) {
    return x / gcd(x, y) * y;

  }

  private static int gcd(int x, int y) {
    while (x > 0 && y > 0) {
      if (x > y) x %= y;
      else y %= x;
    }
    return x + y;
  }


  private static long mod = 1_000_000_007;
  private static double EPS = 1e-6;
  private static int MAX_N = 10000;


  private static void solve() throws IOException {
    int n = 27;
    String ss = readString();
    char[] s = ss.toCharArray();
    int[] used = new int[26];
    Arrays.fill(used, -1);
    int prevIndex = 0;
    int currIndex = 0;
    char ch = '0';
    for (int i = 0; i < n; i++) {
      if (used[s[i] - 'A'] != -1) {
        prevIndex = used[s[i] - 'A'];
        ch = s[i];
        currIndex = i;
      }
      used[s[i] - 'A'] = i;
    }
    int count = currIndex - prevIndex - 1;
    if (count == 0) {
      out.print("Impossible");
      return;
    }
    StringBuilder sb = new StringBuilder(ss + ss + ss);
    String triple = ss + ss + ss;
    String firstLine = triple.substring(n + prevIndex + count/2 - 13 + 1, n + prevIndex + count/2 + 1);
    String secondLine = triple.substring(n + prevIndex + count/2 + 1, n + currIndex);
    secondLine += triple.substring(n + currIndex + 1,  n + prevIndex + count/2 + 15);
    StringBuilder tt = new StringBuilder(secondLine);
    out.println(firstLine);
    out.println(tt.reverse().toString());
  }


}