#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>

typedef struct treeNode {
    char str[501];
    struct treeNode *left, *right;
} Node;

Node* newNode(char *str, int len) {
    Node *new;
    new = (Node*) malloc(sizeof(Node));
    assert(new != NULL);
    new->left = NULL;
    new->right = NULL;
	strncpy(new->str, str, len);
	new->str[len] = '\0';
    return new;
}

Node* insert(Node *x, char *str, int len) {
    if(x == NULL)
        return newNode(str, len);
    int cmp = strncmp(str, x->str, len);
    if(cmp < 0)
    	x->left = insert(x->left, str, len);
    else if(cmp > 0)
    	x->right = insert(x->right, str, len);
    return x;
}

void printAscending(Node *x) {
	if(x == NULL)
		return;
	printAscending(x->left);
	printf("%s\n", x->str);
	printAscending(x->right);
}

int main() {
	int n = 0, len;
	Node *root;
	char inputStr[501];
	scanf("%s", inputStr);
	len = strlen(inputStr);
	for(int i = 0; i < len; ++i) {
		for(int j = 1; j <= len - i; ++j) {
			root = insert(root, inputStr + i, j);
		}
	}
	printAscending(root);
	return 0;
}