#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& n) {
  char ch;
  int flag = 1;
  while (!isdigit(ch = getchar()))
    if (ch == '-') flag = -1;
  n = ch - '0';
  while (isdigit(ch = getchar())) n = n * 10 + ch - '0';
  n *= flag;
}
const int INF = 1e9 + 7;
const double eps = 1e-18;
int n = 27, pos1, pos2;
char ch[311];
int ans[3][311];
int main() {
  for (int i = 1; i <= n; ++i) {
    scanf("%c", &ch[i]);
    for (int j = 1; j < i; ++j)
      if (ch[i] == ch[j]) pos1 = j, pos2 = i;
  }
  int r = pos2 - pos1 - 1;
  if (r <= 0) {
    puts("Impossible");
    return 0;
  }
  if (r % 2 == 0) {
    int right = r / 2, dir = 1, col = 13 - right - pos1 + 2, row = 2;
    if (col < 1)
      for (int i = 1; i <= 1 - col; ++i) ch[++n] = ch[i];
    if (pos1 == 1) row = 1, col = 13 - right;
    pos1 = 13 - right;
    for (int i = 1; i <= n; ++i) {
      if (ans[row][col] && col != pos1) {
        puts("Impossible");
        return 0;
      }
      ans[row][col] = i;
      if (dir == 1 && col == pos1 && row == 2) {
        row--;
        continue;
      }
      if (dir == -1 && col == pos1 + 1 && row == 2) {
        row--, col--;
        continue;
      }
      col += dir;
      if (col == 14 && row == 1) {
        row++, dir = -1, col--;
        continue;
      }
      if (col == 0 && row == 1) {
        col++, row++, dir = 1;
        continue;
      }
    }
  }
  if (r % 2 == 1) {
    int right = (r - 1) / 2, dir = 1, col = 13 - right - pos1 + 1, row = 2;
    if (col < 1)
      for (int i = 1; i <= 1 - col; ++i) ch[++n] = ch[i];
    if (pos1 == 1) row = 1, col = 13 - right;
    pos1 = 13 - right;
    for (int i = 1; i <= n; ++i) {
      if (ans[row][col] && col != pos1) {
        puts("Impossible");
        return 0;
      }
      ans[row][col] = i;
      if (dir == 1 && col == pos1 - 1 && row == 2) {
        row--, col++;
        continue;
      }
      if (dir == -1 && col == pos1 && row == 2) {
        row--;
        continue;
      }
      col += dir;
      if (col == 14 && row == 1) {
        row++, dir = -1, col--;
        continue;
      }
      if (col == 0 && row == 1) {
        col++, row++, dir = 1;
        continue;
      }
    }
  }
  for (int i = 1; i <= 13; ++i) printf("%c", ch[ans[1][i]]);
  puts("");
  for (int i = 1; i <= 13; ++i) printf("%c", ch[ans[2][i]]);
  puts("");
  return 0;
}
