#include <stdio.h>
#include <string.h>

int charcmp(const char *c1, const char *c2) {
  return(*c1-*c2);
}

int main(int argc, char **argv) {
char word[8], stem[8];
int idx;
  for (;;) {
    if (gets(word) == NULL) break;
    for (idx = 0; idx < 7; idx++) {
      strcpy(stem, word); strcpy(stem+idx, word+idx+1);
      qsort(stem, strlen(stem), sizeof(char), charcmp);
      printf("%s %c %s\n", stem, word[idx], word);
    }
  }
  return(0);
}
