#include <iostream>
#include <string>

using namespace std;

/* Structure for storing the definition of a prefix or suffix */
typedef struct {
    string word;
    char *before;
    char *after;
} definition;

/* Definition list of all prefixes */
definition prefix_list[] = {
    { "pre",  "before ", "" },        
    { "post", "after ", "" },        
    { "re",   "", " again" },  
    { "un",   "not ", "" },        
    { "anti", "against ", "" }         
};

/* Total number of prefixes defined */
int const NUMPREFIX = sizeof(prefix_list) / sizeof(definition);

/* Definition list of all prefixes */
definition suffix_list[] = {
    { "ing",  "to actively ", "" },        
    { "er",   "one who ", "s" },        
    { "tion", "the process of ", "ing" },  
    { "s",    "multiple instances of ", "" },        
    { "ize",  "change into ", "" }         
};

/* Total number of suffixes defined */
int const NUMSUFFIX = sizeof(suffix_list) / sizeof(definition);

/* Remove a prefix from word and return number of prefix found */
int find_prefix(string &word) {
    int i;
    
    /* Match each prefix against word */
    for(i = 0; i < NUMPREFIX; i++) {
        string &prefix = prefix_list[i].word;
    
        /* Check if a prefix matches at the beginning of the word */
        if(word.find(prefix) == 0) {
        
            /* Remove the prefix from the word */
            word.erase(0, prefix.size());
            
            /* Return index of the prefix */
            return i;
        }
    }
    
    /* No prefixes/suffixes matched */
    return -1;
}

/* Remove a suffix from word and return number of suffix found */
int find_suffix(string &word) {
    int i;
    
    /* Match each prefix against word */
    for(i = 0; i < NUMSUFFIX; i++) {
        string &suffix = suffix_list[i].word;
        int match;
    
        /* Check if a prefix matches at the end of the word */
        match = word.rfind(suffix);
        if(match != string::npos && match == word.size() - suffix.size()) {
        
            /* Remove the suffix from the word */
            word.erase(match, suffix.size());
            
            /* Return index of the suffix */
            return i;
        }
    }
    
    /* No prefixes/suffixes matched */
    return -1;
}

/* Main body of program */
void process(void)
{
    int count;
    
    /* Throw exceptions on unexpected EOF */
    cin.exceptions(ios::eofbit);
       
    /* Read how many words are to be processed */
    cin >> count;

    /* Process each word */
    while(count > 0) {
        string word;
        int prefix = -1, suffix = -1;
        
        /* Read the word from stdin */
        cin >> word;
        
        /* Search word for prefix and suffix */
        prefix = find_prefix(word);
        suffix = find_suffix(word);

        /* Print 1st half of definitions */
        if(prefix != -1)
            cout << prefix_list[prefix].before;
        if(suffix != -1)
            cout << suffix_list[suffix].before;

        /* Print out the root stem */
        cout << word;

        /* Print 2nd half of definitions */
        if(suffix != -1)
            cout << suffix_list[suffix].after;
        if(prefix != -1)
            cout << prefix_list[prefix].after;

        /* Print new line */
        cout << endl;
        
        count--;
    }
}


/* Run program and print out any exceptions that occur */
int main(void)
{
    /* Run main body of code */
    try {
        process();
    }
    
    /* Catch any internally generated exceptions */
    catch(char const *e) {
        cerr << "Exception: " << e << endl;
    }
    
    /* Catch unexpected EOF on input */
    catch(ios::failure const &ee) {
        cerr << "Exception: Unexpected EOF on input" << endl;
    }
    
    return 0;
}