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;
class Word {
 public:
  vector<string> getGrid(string pathStr, bool &valid) {
    valid = true;
    int dupFrst, dupSec;
    valid = !hasRepeat(pathStr);
    vector<string> retVec;
    if (valid) {
      int nBetDup = getSep(pathStr, dupFrst, dupSec);
      int nLft = nBetDup / 2;
      retVec.push_back("9999999999999");
      retVec.push_back("9999999999999");
      retVec[0][nLft] = pathStr[dupFrst];
      retVec = getRtPre(retVec, pathStr, dupFrst, nLft);
      retVec = getMidLeftBel(retVec, pathStr, dupFrst, nLft, nBetDup);
      int sfxR1Ind = nBetDup - nLft;
      int nCharsSfx = 27 - dupSec - 1;
      retVec = getRtBelSuff(retVec, pathStr, sfxR1Ind, nCharsSfx);
    }
    return retVec;
  }
  vector<string> getRtPre(vector<string> retVec, string pathStr, int dup1Ind,
                          int nLft) {
    int nCh = dup1Ind;
    int startInd = nLft + nCh;
    int resid = 0;
    if ((nCh + nLft + 1) > 13) {
      resid = nCh + nLft + 1 - 13;
      int lowerInd = 13 - resid;
      for (int i = 0; i < resid; i++) {
        retVec[1][lowerInd + i] = pathStr[i];
      }
      startInd = 12;
    }
    for (int i = 0; i < nCh - resid; i++) {
      retVec[0][startInd - i] = pathStr[resid + i];
    }
    return retVec;
  }
  vector<string> getMidLeftBel(vector<string> retVec, string path, int dupFst,
                               int nLeft, int nBetDup) {
    for (int i = nLeft - 1; i >= 0; i--) {
      retVec[0][i] = path[dupFst + 1 + nLeft - 1 - i];
    }
    int rem = nBetDup - nLeft;
    int pathInd = dupFst + nLeft + 1;
    for (int i = 0; i < rem; i++) {
      retVec[1][i] = path[pathInd + i];
    }
    return retVec;
  }
  vector<string> getRtBelSuff(vector<string> retVec, string path, int sfxR1Ind,
                              int nCharsSfx) {
    int pathStartInd = 27 - nCharsSfx;
    int nR1Chars = min(13 - sfxR1Ind, nCharsSfx);
    int nR0Chars = nCharsSfx - nR1Chars;
    for (int i = 0; i < nR1Chars; i++) {
      retVec[1][sfxR1Ind + i] = path[pathStartInd + i];
    }
    pathStartInd += nR1Chars;
    for (int i = 0; i < nR0Chars; i++) {
      retVec[0][12 - i] = path[pathStartInd + i];
    }
    return retVec;
  }
  int getSep(string s, int &df, int &ds) {
    int len = s.length();
    unordered_map<char, bool> seen;
    char dupCh;
    for (int i = 0; i < len; i++) {
      char ch = s[i];
      if (seen.find(ch) != seen.end()) {
        ds = i;
        dupCh = ch;
        break;
      } else {
        seen[ch] = true;
      }
    }
    df = s.find(dupCh);
    int retLen = ds - df - 1;
    return retLen;
  }
  bool hasRepeat(string s) {
    bool retV = false;
    int len = s.length();
    for (int i = 0; i < (len - 1); i++) {
      if (s[i] == s[i + 1]) {
        retV = true;
        break;
      }
    }
    return retV;
  }
};
int main(int argc, const char *argv[]) {
  Word w;
  bool valid;
  string pathStr;
  getline(cin, pathStr);
  vector<string> grid = w.getGrid(pathStr, valid);
  if (!valid) {
    cout << "Impossible";
  } else {
    cout << grid[0] << endl;
    cout << grid[1];
  }
  cout << endl;
  return 0;
}