// Arup Guha
// 8/30/2016
// Program to aid decryption for CIS 3362 Week One Assignment
// Lazy solution for Question 3, can be used for question 4 as well.

#include <stdio.h>
#include <string.h>

const int ALIST[] = {1,3,5,7,9,11,15,17,19,21,23,25};

int main() {

    char cipher[1000];
    scanf("%s", cipher);

    int a, b=19, i=6, j;

    // Try each key.
    for (i=0; i<12; i++) {
        for (b=0; b<26; b++) {
            printf("%d %d\t", ALIST[i], b);
            for (j=0; j<strlen(cipher); j++)
                printf("%c", (ALIST[i]*(cipher[j]-'a')+b)%26 + 'a');
            printf("\n");
        }
    }
    printf("\n");

    return 0;
}
