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:16777216")
using namespace std;
template <typename t1>
t1 gcd(t1 a, t1 b) {
  return b == 0 ? a : gcd(b, a % b);
}
template <typename t1>
t1 lcm(t1 a, t1 b) {
  return a * (b / gcd(a, b));
}
template <typename t1>
bool check(t1 i, t1 k) {
  return i & ((t1)1 << k);
}
template <typename t1>
t1 On(t1 i, t1 k) {
  return i | ((t1)1 << k);
}
template <typename t1>
t1 Off(t1 i, t1 k) {
  return (i - ((check(i, k)) << k));
}
template <typename t1>
int c_lower_bound(vector<t1> arr, int lo, int hi, t1 key) {
  int mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (arr[mid] == key) {
      hi = mid - 1;
    } else if (arr[mid] > key) {
      hi = mid - 1;
    } else if (arr[mid] < key) {
      lo = mid + 1;
    }
  }
  return (hi + 1);
}
template <typename t1>
int c_upper_bound(vector<t1> arr, int lo, int hi, t1 key) {
  int mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (arr[mid] == key) {
      lo = mid + 1;
    } else if (arr[mid] > key) {
      hi = mid - 1;
    } else if (arr[mid] < key) {
      lo = mid + 1;
    }
  }
  return (lo - 1);
}
template <typename t1>
int c_binary_search(vector<t1> arr, int lo, int hi, t1 key) {
  int mid;
  while (lo <= hi) {
    mid = (lo + hi) / 2;
    if (fabs(arr[mid] - key) < 1e-9) {
      return mid;
    } else if (arr[mid] > key) {
      hi = mid - 1;
    } else if (arr[mid] < key) {
      lo = mid + 1;
    }
  }
  return -1;
}
double rad_to_deg(double x) { return x * (180.0 / acos(-1.00)); }
double deg_to_rad(double x) { return x * (acos(-1.00) / 180.0); }
vector<double> tri_angle(double a, double b, double c) {
  double A, B, C;
  A = acos(((b * b + c * c - a * a) / (2 * b * c)));
  B = acos(((a * a + c * c - b * b) / (2 * a * c)));
  C = acos(-1.00) - A - B;
  double arr[] = {rad_to_deg(A), rad_to_deg(B), rad_to_deg(C)};
  vector<double> ret(arr, arr + sizeof(arr) / sizeof(double));
  return ret;
}
double tri_area(double a, double b, double c) {
  double p = (a + b + c) / 2.0;
  double area = p * (p - a) * (p - b) * (p - c);
  return sqrt(area);
}
double circle_area(double r) { return acos(-1.00) * r * r; }
double circle_peripheri(double r) { return 2.0 * acos(-1.00) * r; }
struct pts {
  double x, y;
  pts() {}
  pts(double xx, double yy) {
    x = xx;
    y = yy;
  }
  bool operator<(const pts& ot) const {
    if (this->y > ot.y)
      return true;
    else if (this->y == ot.y) {
      return (this->x < ot.x);
    } else
      return false;
  }
  double distance(pts ot) {
    return sqrt((x - ot.x) * (x - ot.x) + (y - ot.y) * (y - ot.y));
  }
};
struct line {
  double a, b, c;
  line() {}
  line(pts p1, pts p2) {
    a = p1.y - p2.y;
    b = p2.x - p1.x;
    c = p1.x * p2.y - p2.x * p1.y;
  }
  line(double aa, double bb, double cc) {
    a = aa;
    b = bb;
    c = cc;
  }
  pts intersection(line l2) {
    line l1(a, b, c);
    double y = (l2.a * l1.c - l1.a * l2.c);
    y /= (l1.a * l2.b - l2.a * l1.b);
    double x = (-1 * l1.c - l1.b * y);
    x /= l1.a;
    pts ret(x, y);
    return ret;
  }
};
vector<line> tangent_eq(pts a, pts b, double r) {
  double dx = a.x - b.x;
  double dy = b.y - a.y;
  double m1 = 2 * dy * dx + sqrt(4 * dy * dy * dx * dx +
                                 4 * (r * r - dx * dx) * (dy * dy - r * r));
  double m2 = 2 * dy * dx - sqrt(4 * dy * dy * dx * dx +
                                 4 * (r * r - dx * dx) * (dy * dy - r * r));
  m1 /= (2 * (r * r - dx * dx));
  m2 /= (2 * (r * r - dx * dx));
  double c1 = a.y - m1 * a.x;
  double c2 = a.y - m2 * a.x;
  line la(m1, -1, c1), l2(m2, -1, c2);
  vector<line> ret;
  ret.push_back(la);
  ret.push_back(l2);
  return ret;
}
line perpendicular(line aa, pts bb) {
  line la(aa.b, -1 * aa.a, (aa.a * bb.y - aa.b * bb.x));
  return la;
}
double tri_area_pts(pts a, pts b, pts c) {
  double x = a.distance(b);
  double y = b.distance(c);
  double z = c.distance(a);
  return tri_area(x, y, z);
}
vector<double> triangle_sides_to_angles(double a, double b, double c) {}
map<char, vector<int> > pos;
int main() {
  string s;
  cin >> s;
  char doubly;
  for (int i = 0; i < 27; i++) {
    pos[s[i]].push_back(i);
    if (pos[s[i]].size() == 2) {
      doubly = s[i];
    }
  }
  if (abs(pos[doubly][1] - (pos[doubly][0])) == 1) {
    cout << "Impossible\n";
    return 0;
  } else {
    int mid_pos = pos[doubly][0];
    int last_ln = 27 - pos[doubly][1] - 1;
    int mid_ind = (mid_pos + last_ln) / 2;
    char arr[3][15];
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 13; j++) {
        arr[i][j] = '_';
      }
    }
    arr[0][13] = arr[1][13] = '\0';
    arr[0][mid_ind] = doubly;
    int lst = mid_pos;
    int i, j;
    for (j = mid_ind - 1; j >= 0 && lst >= 1; j--) {
      arr[0][j] = s[--lst];
    }
    bool to = 0;
    if (lst != 0) {
      to = 1;
      for (j = 0; j <= 12 && lst >= 1; j++) {
        arr[1][j] = s[--lst];
      }
    }
    int between = pos[doubly][1] - 1 - pos[doubly][0];
    if (between % 2 == 0) {
      int lst = mid_pos;
      for (j = mid_ind + 1; j <= 12; j++) {
        arr[1][j] = s[++lst];
      }
      for (j = 12; j > mid_ind; j--) {
        arr[0][j] = s[++lst];
      }
      lst++;
      for (j = mid_ind; j >= 0 && lst + 1 <= 26; j--) {
        arr[1][j] = s[++lst];
      }
      if (lst != 26) {
        for (j = 0; j <= 12 && lst + 1 <= 26; j++) {
          arr[0][j] = s[++lst];
        }
      }
    } else {
      int lst = mid_pos;
      for (j = mid_ind; j <= 12; j++) {
        arr[1][j] = s[++lst];
      }
      for (j = 12; j > mid_ind; j--) {
        arr[0][j] = s[++lst];
      }
      lst++;
      for (j = mid_ind - 1; j >= 0 && lst + 1 <= 26; j--) {
        arr[1][j] = s[++lst];
      }
      if (lst != 26) {
        for (j = 0; j <= 12 && lst + 1 <= 26; j++) {
          arr[0][j] = s[++lst];
        }
      }
    }
    puts(arr[0]);
    puts(arr[1]);
  }
}