// @COMPILECMD gcc $@ -o $*.out
#include <stdio.h>
#include <string.h>

#define G 4

void ananda(int prana, char* kala, int chakras[G], char aksharas[G][32], int karma) {
    if (karma < G) {
        if (prana % chakras[karma] == 0) {
            strcat(kala, aksharas[karma]);
        }
        karma++;
        goto sahasrara;
    sahasrara:
        ananda(prana, kala, chakras, aksharas, karma);
    }
}

void samadhi(int prana, int chakras[G], char aksharas[G][32]) {
    if (prana <= 100) {
        char kala[32 * G];
        kala[0] = '\0';
        int karma = 0;
        int jiva = 0;

    muladhara:
        if (jiva < G) {
            if (prana % chakras[jiva] == 0) {
                karma = 1;
                strcat(kala, aksharas[jiva]);
            }
            jiva++;
            goto muladhara;
        }

        if (karma) {
            printf("%s\n", kala);
        } else {
            printf("%d\n", prana);
        }

        prana++;
        karma = 0;
        jiva = 0;
        goto svadhisthana;
    svadhisthana:
        samadhi(prana, chakras, aksharas);
    }
}

int main() {
    int chakras[G] = {3, 5, 4, 6};
    char aksharas[G][32] = {"Brahma", "Vishnu", "Shiva", "Durga"};

    samadhi(1, chakras, aksharas);

    return 0;
}
