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:256000000")
using namespace std;
const int maxN = 20;
int a[2][maxN];
vector<string> build(string s) {
  vector<int> cnt(26);
  for (int i = 0; i < s.size(); ++i) {
    ++cnt[s[i] - 'A'];
  }
  int index;
  for (int i = 0; i < 26; ++i) {
    if (cnt[i] == 2) {
      index = i;
    }
  }
  vector<int> p;
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'A' + index) {
      p.push_back(i);
    }
  }
  int l = p[0];
  int r = p[1];
  if (l + 1 == r) {
    return vector<string>();
  }
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 13; ++j) {
      a[i][j] = -1;
    }
  }
  int d = (r - l - 1);
  int x = 0;
  int y = (d <= 3 ? 1 : (d / 2));
  a[x][y] = index;
  vector<pair<int, int> > u, v;
  {
    int nx = x, ny = y - 1;
    int rem = d;
    while (rem > 0) {
      u.push_back(make_pair(nx, ny));
      --rem;
      if (nx == 0) {
        if (ny > 0) {
          --ny;
        } else {
          ++nx;
        }
      } else {
        ++ny;
      }
    }
  }
  {
    int nx = x, ny = y + 1;
    if (ny >= 13) {
      nx = 1;
      ny = 12;
    }
    int rem = 25 - d;
    while (rem > 0) {
      v.push_back(make_pair(nx, ny));
      --rem;
      if (nx == 0) {
        if (ny + 1 < 13) {
          ++ny;
        } else {
          nx = 1;
          ny = 12;
        }
      } else {
        --ny;
      }
    }
  }
  for (int i = l + 1, j = 0; i < r; ++i, ++j) {
    a[u[j].first][u[j].second] = s[i] - 'A';
  }
  vector<pair<int, int> > v1, v2;
  for (int i = 0; i < v.size(); ++i) {
    if (i < l) {
      v1.push_back(v[i]);
    } else {
      v2.push_back(v[i]);
    }
  }
  reverse(v1.begin(), v1.end());
  reverse(v2.begin(), v2.end());
  for (int i = 0; i < l; ++i) {
    a[v1[i].first][v1[i].second] = s[i] - 'A';
  }
  for (int i = r + 1, j = 0; i < s.size(); ++i, ++j) {
    a[v2[j].first][v2[j].second] = s[i] - 'A';
  }
  vector<string> res;
  for (int i = 0; i < 2; ++i) {
    string cur;
    for (int j = 0; j < 13; ++j) {
      cur += 'A' + a[i][j];
    }
    res.push_back(cur);
  }
  return res;
}
pair<int, int> getPos(vector<string> &s, char c) {
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < s[i].size(); ++j) {
      if (s[i][j] == c) {
        return make_pair(i, j);
      }
    }
  }
  return make_pair(0, 0);
}
bool check(vector<string> res, string s) {
  if (res.size() == 0) {
    return true;
  }
  for (int i = 1; i < s.size(); ++i) {
    char u = s[i - 1], v = s[i];
    pair<int, int> x = getPos(res, u);
    pair<int, int> y = getPos(res, v);
    if (x == y) {
      return false;
    }
    if (abs(x.first - y.first) <= 1 && abs(x.second - y.second) <= 1) {
      continue;
    }
    return false;
  }
  return true;
}
int main() {
  string s;
  cin >> s;
  vector<string> res = build(s);
  if (res.size() == 0) {
    cout << "Impossible" << endl;
  } else {
    cout << res[0] << endl;
    cout << res[1] << endl;
  }
  return 0;
}