#include <bits/stdc++.h>
using namespace std;
const long long N = 30;
bool vis[N];
int id1 = -1, id2 = -1;
char ch;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = 27;
  for (int i = 0; i < 27; i++) {
    if (vis[s[i] - 'A']) {
      id2 = i;
      ch = s[i];
    } else {
      vis[s[i] - 'A'] = true;
    }
  }
  for (int i = 0; i < 27; i++) {
    if (s[i] == ch) {
      id1 = i;
      break;
    }
  }
  if (id2 == id1 + 1) {
    cout << "Impossible\n";
    return 0;
  }
  if ((id2 - id1 - 1) % 2 == 1) {
    int cnt = id2 - id1 - 1;
    int rast = cnt / 2, chap = n - id2 - 1;
    if (rast + chap + 1 <= 13) {
      int rem = 13 - rast - chap - 1;
      for (int i = rem; i < id1; i++) cout << s[i];
      for (int i = id1 + 1; i <= id1 + cnt / 2 + 1; i++) cout << s[i];
      cout << '\n';
      for (int i = rem - 1; i >= 0; i--) cout << s[i];
      for (int i = n - 1; i > id2; i--) cout << s[i];
      cout << ch;
      for (int i = id2 - 1; i >= id2 - cnt / 2; i--) cout << s[i];
      cout << '\n';
    } else {
      int rem = rast + chap + 1 - 13;
      for (int i = 0; i < rem; i++) cout << s[n - rem + i];
      for (int i = 0; i < id1; i++) cout << s[i];
      for (int i = id1 + 1; i <= id1 + cnt / 2 + 1; i++) cout << s[i];
      cout << '\n';
      for (int i = n - rem - 1; i > id2; i--) cout << s[i];
      cout << ch;
      for (int i = id2 - 1; i >= id2 - cnt / 2; i--) cout << s[i];
    }
  } else {
    int cnt = id2 - id1 - 1;
    int rast = cnt / 2, chap = n - id2 - 1;
    if (rast + chap + 1 <= 13) {
      int rem = 13 - rast - chap - 1;
      for (int i = rem; i < id1; i++) cout << s[i];
      for (int i = id1 + 1; i <= id1 + cnt / 2; i++) cout << s[i];
      cout << '\n';
      for (int i = rem - 1; i >= 0; i--) cout << s[i];
      for (int i = n - 1; i > id2; i--) cout << s[i];
      cout << ch;
      for (int i = id2 - 1; i >= id2 - cnt / 2; i--) cout << s[i];
      cout << '\n';
    } else {
      int rem = rast + chap + 1 - 13;
      for (int i = 0; i < rem; i++) cout << s[n - rem + i];
      for (int i = 0; i < id1; i++) cout << s[i];
      for (int i = id1 + 1; i <= id1 + cnt / 2; i++) cout << s[i];
      cout << '\n';
      for (int i = n - rem - 1; i > id2; i--) cout << s[i];
      cout << ch;
      for (int i = id2 - 1; i >= id2 - cnt / 2; i--) cout << s[i];
    }
  }
}
