#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using ll = int64_t;
using ld = long double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;
typedef vector <int> vi;
typedef pair <int, int> ii;

const int INF = (int)1e9;

#define maxn 100010

#define MAX_N 100010 // second approach: O(n log n)

char T[MAX_N]; // the input string, up to 100K characters
int n; // the length of input string
int RA[MAX_N], tempRA[MAX_N]; // rank array and temporary rank array
int SA[MAX_N], tempSA[MAX_N]; // suffix array and temporary suffix array
int c[MAX_N]; // for counting/radix sort

void countingSort(int k) { // O(n)
    int i, sum, maxi = max(300, n); // up to 255 ASCII chars or length of n
    memset(c, 0, sizeof c); // clear frequency table
    for (i = 0; i < n; i++) // count the frequency of each integer rank
        c[i + k < n ? RA[i + k] : 0]++;
    for (i = sum = 0; i < maxi; i++) {
        int t = c[i]; c[i] = sum; sum += t; }
    for (i = 0; i < n; i++) // shuffle the suffix array if necessary
        tempSA[c[SA[i]+k < n ? RA[SA[i]+k] : 0]++] = SA[i];
    for (i = 0; i < n; i++) // update the suffix array SA
        SA[i] = tempSA[i];
}

void constructSA() { // this version can go up to 100000 characters
    int i, k, r;
    for (i = 0; i < n; i++) RA[i] = T[i]; // initial rankings
    for (i = 0; i < n; i++) SA[i] = i; // initial SA: {0, 1, 2, ..., n-1}
    for (k = 1; k < n; k <<= 1) { // repeat sorting process log n times
        countingSort(k); // actually radix sort: sort based on the second item
        countingSort(0); // then (stable) sort based on the first item
        tempRA[SA[0]] = r = 0; // re-ranking; start from rank r = 0
        for (i = 1; i < n; i++) // compare adjacent suffixes
            tempRA[SA[i]] = // if same pair => same rank r; otherwise, increase r
                    (RA[SA[i]] == RA[SA[i-1]] && RA[SA[i]+k] == RA[SA[i-1]+k]) ? r : ++r;
        for (i = 0; i < n; i++) // update the rank array RA
            RA[i] = tempRA[i];
        if (RA[SA[n-1]] == n-1) break; // nice optimization trick
    }
}

int main() {
#ifdef BZ
    freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(6);


    n = 1e5;
    for(int i = 0; i < n; i++) {
        T[i] = (char)('a' + rand() % 26);
    }
    T[n] = '\0';

    //cout << T << "\n";

    n = (int)strlen(T); // input T as per normal, without the ‘$’
    T[n++] = '$'; // add terminating character
    T[n] = '\0';
    constructSA();

    set <char> vowels, cons;

    vowels.insert('a');
    vowels.insert('e');
    vowels.insert('i');
    vowels.insert('o');
    vowels.insert('u');

    int last_cons = 0;

    for(int i = 0; i < n - 1; i++) {
        if(!vowels.count(T[i])) {
            last_cons = i;
        }
    }

    //cout << last_cons << "\n";

    string fi, se;

    for(int i = 1; i < n; i++) {
        if(SA[i] < last_cons and vowels.count(T[SA[i]])) {
            int end = 0;
            for(int j = SA[i]; j < n - 1; j++) {
                fi += T[j];
                if(!vowels.count(T[j])) {
                    break;
                }
            }
            break;
        }
    }

    for(int i = n - 1; i >= 1; i--) {
        if(SA[i] < last_cons and vowels.count(T[SA[i]])) {
            int end = 0;
            for(int j = SA[i]; j <= last_cons; j++) {
                se += T[j];
            }
            break;
        }
    }

    cout << fi << "\n" << se.substr(0, 20) << "\n";
}