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>
using namespace std;
template <typename T>
inline string toString(T a) {
  ostringstream os("");
  os << a;
  return os.str();
}
template <typename T>
inline long long toLong(T a) {
  long long res;
  istringstream os(a);
  os >> res;
  return res;
}
template <typename T>
inline int toInt(T a) {
  int res;
  istringstream os(a);
  os >> res;
  return res;
}
template <typename T>
inline double toDouble(T a) {
  double res;
  istringstream os(a);
  os >> res;
  return res;
}
template <typename T>
inline T SQ(T a) {
  return a * a;
}
template <typename T>
inline T GCD(T a, T b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
template <typename T>
inline T LCM(T a, T b) {
  long long res = a * b;
  res /= GCD(a, b);
  return res;
}
template <typename T>
inline unsigned long long BIGMOD(T a, T b, T m) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return SQ(BIGMOD(a, b / 2, m)) % m;
  else
    return (a % m * BIGMOD(a, b - 1, m)) % m;
}
template <typename T>
inline vector<string> PARSE(T str) {
  vector<string> res;
  string s;
  istringstream os(str);
  while (os >> s) res.push_back(s);
  return res;
}
template <typename T>
inline unsigned long long DIST(T A, T B) {
  unsigned long long res =
      (A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y);
  return res;
}
template <typename T>
inline long long CROSS(T A, T B, T C) {
  return (B.x - A.x) * (C.y - A.y) - (C.x - A.x) * (B.y - A.y);
}
template <typename T>
inline double cosAngle(T a, T b, T c) {
  double res = a * a + b * b - c * c;
  res = res / (2 * a * b);
  res = acos(res);
  return res;
}
template <typename T>
inline T POWER(T base, int po) {
  T res = 1;
  if (base == 0) return 0;
  for (int i = (0); i < (po); i++) res *= base;
  return res;
}
template <typename T>
inline bool IS_ON(T mask, T pos) {
  return mask & (1 << pos);
}
template <typename T>
inline int OFF(T mask, T pos) {
  return mask ^ (1 << pos);
}
template <typename T>
inline int ON(T mask, T pos) {
  return mask | (1 << pos);
}
template <typename T>
inline bool INSIDE_GRID(int R, int C, int ro, int clm) {
  if (R >= 0 && C >= 0 && R < ro && C < clm) return 1;
  return 0;
}
template <typename T>
inline void PRINT_GRID(T GRID, int ro, int clm) {
  cout << "GRID"
       << ": " << GRID << endl;
  for (int i = (0); i < (ro); i++) {
    for (int j = (0); j < (clm); j++) cout << GRID[i][j] << " ";
    puts("");
  }
}
template <typename T>
inline void PrV(vector<T> v) {
  for (int i = (0); i < (v.size()); i++) {
    cout << v[i] << " # ";
  }
  cout << endl;
}
string str;
deque<char> Q[2];
void solve(int x, int y) {
  bool flag = 1;
  if (y - x == 1) flag = 0;
  if (!flag) {
    cout << "Impossible\n";
    return;
  }
  int n = abs(x - y);
  int st, ed, a, b;
  st = 14 - ((n + 1) / 2);
  a = x;
  b = y;
  int c = 0;
  int d = 0;
  for (int i = st; i <= 13; i++) {
    Q[0].push_back(str[a]);
    a++;
    c++;
  }
  while (a < y) {
    Q[1].push_front(str[a]), d++;
    a++;
  }
  x--;
  while (c < 13 && x >= 1) {
    Q[0].push_front(str[x]), c++;
    x--;
  }
  y++;
  while (d < 13 && y <= 27) {
    Q[1].push_front(str[y]);
    y++;
    d++;
  }
  if (x >= 1) {
    for (int i = 1; i <= x; i++) Q[1].push_front(str[i]);
  }
  if (y <= 27) {
    for (int i = 27; i >= y; i--) Q[0].push_front(str[i]);
  }
  for (int i = 0; i < 2; i++) {
    while (!Q[i].empty()) {
      cout << Q[i].front();
      Q[i].pop_front();
    }
    cout << endl;
  }
}
int main() {
  cin >> str;
  str = " " + str;
  for (int i = 1; i <= 27; i++) {
    for (int j = i + 1; j <= 27; j++) {
      if (str[i] == str[j]) {
        solve(i, j);
        return 0;
      }
    }
  }
  return 0;
}