Problem: Andrey's favourite number is n. Andrey's friends gave him two identical numbers n as a New Year present. He hung them on a wall and watched them adoringly.

Then Andrey got bored from looking at the same number and he started to swap digits first in one, then in the other number, then again in the first number and so on (arbitrary number of changes could be made in each number). At some point it turned out that if we sum the resulting numbers, then the number of zeroes with which the sum will end would be maximum among the possible variants of digit permutations in those numbers.

Given number n, can you find the two digit permutations that have this property?

Input

The first line contains a positive integer n — the original number. The number of digits in this number does not exceed 105. The number is written without any leading zeroes.

Output

Print two permutations of digits of number n, such that the sum of these numbers ends with the maximum number of zeroes. The permutations can have leading zeroes (if they are present, they all should be printed). The permutations do not have to be different. If there are several answers, print any of them.

Examples

Input

198


Output

981
819


Input

500


Output

500
500

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int mx = 0;
string a, b;
string ba, bb;
int sum[123] = {};
void solve(int last) {
  int cursum1[123];
  int cursum2[123];
  memcpy(cursum1, sum, sizeof sum);
  memcpy(cursum2, sum, sizeof sum);
  if (cursum1[last] == 0 || cursum2[(10 - last) % 10] == 0) {
    int mn = min(cursum1[0], cursum2[0]);
    if (mn == 0) return;
    if (mn > mx) {
      mx = mn;
      sort(ba.begin(), ba.end(), greater<char>());
      sort(bb.begin(), bb.end(), greater<char>());
    }
    return;
  }
  string na, nb;
  string zero;
  cursum1[last]--;
  cursum2[(10 - last) % 10]--;
  na += last + '0';
  nb += ((10 - last) % 10) + '0';
  int now = 1;
  for (;;) {
    bool fnd = false;
    for (int put = 0; put <= 9; put++) {
      int need = (9 - put) % 10;
      if (cursum1[put] > 0 && cursum2[need] > 0) {
        na += put + '0';
        nb += need + '0';
        cursum1[put]--;
        cursum2[need]--;
        fnd = true;
        break;
      }
    }
    if (fnd)
      ++now;
    else {
      int mn = min(cursum1[0], cursum2[0]);
      cursum1[0] -= mn;
      cursum2[0] -= mn;
      for (int i = 0; i < mn; i++) {
        zero += '0';
      }
      now += mn;
      for (int put = 0; put <= 9; put++) {
        for (int u = 0; u < cursum1[put]; u++) na += put + '0';
      }
      for (int put = 0; put <= 9; put++) {
        for (int u = 0; u < cursum2[put]; u++) nb += put + '0';
      }
      break;
    }
  }
  if (now > mx) {
    mx = now;
    reverse(na.begin(), na.end());
    reverse(nb.begin(), nb.end());
    ba = na + zero;
    bb = nb + zero;
  }
}
void solveAll(string& str) {
  a = str;
  memset(sum, 0, sizeof sum);
  mx = 0;
  for (int i = 0; i < a.size(); i++) sum[a[i] - '0']++;
  ba = bb = a;
  for (int last = 1; last <= 9; last++) {
    solve(last);
  }
}
int parse(const string& str) {
  int ret = 0;
  for (int i = 0; i < str.size(); i++) {
    ret = ret * 10 + str[i] - '0';
  }
  return ret;
}
int count(int num) {
  int ret = 0;
  while (num) {
    if (num % 10 == 0)
      ++ret;
    else
      break;
    num /= 10;
  }
  return ret;
}
void test() {
  for (int i = 0; i < 1231; i++) {
    string ran;
    ran += (rand() % 9) + 1 + '0';
    int len = rand() % 6;
    ++len;
    for (int u = 1; u < len; u++) {
      ran += (rand() % 10) + '0';
    }
    solveAll(ran);
    int mx1 = 0;
    sort(ran.begin(), ran.end());
    do {
      string ran2 = ran;
      sort(ran2.begin(), ran2.end());
      do {
        int num1 = parse(ran);
        int num2 = parse(ran2);
        num1 += num2;
        int howmany = count(num1);
        mx1 = max(mx1, howmany);
      } while (next_permutation(ran2.begin(), ran2.end()));
    } while (next_permutation(ran.begin(), ran.end()));
    if (mx != mx1) {
      cout << ran << "  wrong" << endl;
      exit(0);
    }
  }
  cout << "OK" << endl;
}
int main() {
  cin >> a;
  solveAll(a);
  cout << ba << endl << bb << endl;
  return 0;
}