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 CPP):

Solution:
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD = 1e9 + 7;
const double pi = acos(-1.0);
const double eps = 1e-6;
const int maxn = 1e3 + 5;
const int maxm = 1e6 + 5;
const int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
inline int scan(int &a) { return scanf("%d", &a); }
inline int scan(int &a, int &b) { return scanf("%d%d", &a, &b); }
inline int scan(int &a, int &b, int &c) { return scanf("%d%d%d", &a, &b, &c); }
inline int scan(long long &a) { return scanf("%I64d", &a); }
inline int scan(long long &a, long long &b) {
  return scanf("%I64d%I64d", &a, &b);
}
inline int scan(long long &a, long long &b, long long &c) {
  return scanf("%I64d%I64d%I64d", &a, &b, &c);
}
inline int scan(double &a) { return scanf("%lf", &a); }
inline int scan(double &a, double &b) { return scanf("%lf%lf", &a, &b); }
inline int scan(double &a, double &b, double &c) {
  return scanf("%lf%lf%lf", &a, &b, &c);
}
inline int scan(char &a) { return scanf("%c", &a); }
inline int scan(char *a) { return scanf("%s", a); }
template <class T>
inline void mem(T &A, int x) {
  memset(A, x, sizeof(A));
}
template <class T0, class T1>
inline void mem(T0 &A0, T1 &A1, int x) {
  mem(A0, x), mem(A1, x);
}
template <class T0, class T1, class T2>
inline void mem(T0 &A0, T1 &A1, T2 &A2, int x) {
  mem(A0, x), mem(A1, x), mem(A2, x);
}
template <class T0, class T1, class T2, class T3>
inline void mem(T0 &A0, T1 &A1, T2 &A2, T3 &A3, int x) {
  mem(A0, x), mem(A1, x), mem(A2, x), mem(A3, x);
}
template <class T0, class T1, class T2, class T3, class T4>
inline void mem(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, int x) {
  mem(A0, x), mem(A1, x), mem(A2, x), mem(A3, x), mem(A4, x);
}
template <class T0, class T1, class T2, class T3, class T4, class T5>
inline void mem(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, int x) {
  mem(A0, x), mem(A1, x), mem(A2, x), mem(A3, x), mem(A4, x), mem(A5, x);
}
template <class T0, class T1, class T2, class T3, class T4, class T5, class T6>
inline void mem(T0 &A0, T1 &A1, T2 &A2, T3 &A3, T4 &A4, T5 &A5, T6 &A6, int x) {
  mem(A0, x), mem(A1, x), mem(A2, x), mem(A3, x), mem(A4, x), mem(A5, x),
      mem(A6, x);
}
template <class T>
inline T min(T a, T b, T c) {
  return min(min(a, b), c);
}
template <class T>
inline T max(T a, T b, T c) {
  return max(max(a, b), c);
}
template <class T>
inline T min(T a, T b, T c, T d) {
  return min(min(a, b), min(c, d));
}
template <class T>
inline T max(T a, T b, T c, T d) {
  return max(max(a, b), max(c, d));
}
template <class T>
inline T min(T a, T b, T c, T d, T e) {
  return min(min(min(a, b), min(c, d)), e);
}
template <class T>
inline T max(T a, T b, T c, T d, T e) {
  return max(max(max(a, b), max(c, d)), e);
}
int cnt[26];
char s[30];
char out[2][14];
int main() {
  scan(s);
  for (int i = 0; i < 27; i++) cnt[s[i] - 'A']++;
  char c;
  for (int i = 0; i < 26; i++)
    if (cnt[i] == 2) c = i + 'A';
  int l = -1, r = -1;
  for (int i = 0; i < 27; i++)
    if (s[i] == c) {
      if (l == -1)
        l = i;
      else
        r = i;
    }
  if (l == r - 1)
    return 0 * puts("Impossible");
  else {
    int pos = (l + r) / 2 - ((r - l - 1) & 1);
    int i, j;
    for (i = 12, j = pos; j >= l; j--, i--) out[0][i] = s[j];
    for (i = 12, j = pos + 1; j < r; j++, i--) out[1][i] = s[j];
    j = l - 1;
    for (; i >= 0; i--, j--) out[1][i] = s[(j + 27) % 27];
    for (i = 0; out[0][i] != c; i++, j--) out[0][i] = s[(j + 27) % 27];
  }
  for (int i = 0; i < 2; i++) puts(out[i]);
  return 0;
}