#include <unistd.h>
#include <stdio.h>
char ans[] = "  0   0   0   0   0   1   0   0   0   0   3   0   0   0   0   0   3   3   0   0   0   0   0   1   6   0   3   0   0   0   0   0   3   3   6   0   0   3   0   0   0   0   3   3   6   0   6   0   0   0   3   0   0   1   6   0   6   6   0   0   6   0   0   0   0   3   3   3   6   0   6   3   6   0   0   0   6   0   0   0   3   3   9   0   6   3   6   0   3   6   0   0   0   0   6   1   6   0   6   6   0   3  12   0   6   0   0   3   6   0   0   0   3   3  12   0   6   3   6   0   3   6   9   0   6   0   0   0   3   6   3   3   6   0   6   3  12   0   3   6   6   0   6   0   6   3   6   0   0   1   6   3  12   6   0   0  12   0   6   0   6   6  12   0   0   6   0   0   6   0  12   3   6   0   6   3   9   6   3   6   6   0   6   0   6   0  15   6   0   0   6   0   3   3  12   0  12   6   6   0   3   6   6   3  12   0   6   0   9   6   0   0   6   3  12   1   6   6   6   6   0   0  18   0  12   0   3   6  12   0   0   6   3   6  12   0  12   0   0   0   9   3   9   6  12   3  12   0   3   6   6   0  12   0  12   0   9   9   0   0   6   3   6   3  12   6   9   3   6   0  12   3   6   3   9   6  12   6   6   0   6   0   9   6   6   0  12   3   6   0   9   6   6   1   6   0  21  12   6   0  12   0  12   0   0   6  15   6   0   6  12   0  12   0  12   0   0   0  12   0  12  12   3   3  18   3   6   3   6   6   9   9  18   0   6   0  12   0   9   6   0   3  12   3   6   6  12   6   6   0   0   0  15   3  18   3  18   3  12   6   3   6   9   0  12   0  12   0  18  12   0   0  12   3   6   0   6   6   9   6   0   0  18   1  18   3  12   6   6   6  12   0  15   6  12   6  18   0   0   6   0   9  12   0  18   0   6   3  12   0  12  12   0   0  12   0   3   6  12   6  18   9  18   0   9   6  18   0   6   0   6   3  27   6   6   6   6   3   6   0  12   6   9   0   6   0  18   0   9   9  15   3  12   6   6   3   9   6  12  12  18   0  18   0   6   6  21   6   0   0   6   3  15   6  12   6  18   0   0   0  12   6   6   3   6   4  18   6  12   6   3   9  30   0  18   0   6   6  12   6   6   9  12   0  18   6  18   0   6   0  12   0   6  12   6   3  18   0   6   6   6   6  15   3  24   0   6   3  18   0  12   6  12   6  24   0  15  18   9   6   0   0  18   3   6   0  15  12  12   6   6   0  18   0   6   3  12   0  12   6   6   9   9   6  24   3  24   0   9  12   6   6  12   0  12   0  21   9  15   6  12   3  18   3  12   6  12   6   0   0  12   0  12   6  24   0   6  12   6   1   9   6  12   6  24   0  18   3  12   6   6  12  24   0  12   6  15   6  18   0  18   0   0   0  18   9  21  12   0   6  18   0   9   6   6   6  12   0  12   0   9   9  27   6   6   3  18   6  21   6   6  12  12   0  12   0  24  12   0   0  24   3  24   6  12  12  18   0   0   0  12   0  18   3  15   6  12   9   6   0  15   6   9  12  24   0  12   3   6   6  21   6  18   3  18   0  21  12  15   6   6   0  12   3  12   9  18   9  12   6   6   6  24   0  18   3  24   0   6   6   0   6   9   6   6   4  30   0  18  12   9   6  24   0  18   0   9  12  21   6   6  12  12   0  18   0  21  15  12   0  12   6  12  12  18   0  18   0   6   0   9  12  18   6  30   0   0   0  24   6   9   3  12   6  30   3   6  12   6  12  12   0  36   0   6   3  27  12  12   6   6   6  24   0  12   6  12   0  18   0  18  15  18   3  18   6  12   6   6  12   3   6   6   0  12   3  39   3  12  12  12   3  18   0  21  12  21   6  18   0  12   0   9   9  12   9  24   9  12   6  12   6  33   0   6   0  18   0   9  15  12   6  24   6   6   3  15   6  15  12  18   0  18   1  18   6  12   6   6   0  24   6  24  12  18   6  24   0   6   6  12  15  24   0  24   6   6   0  18   0  15  18  12   0  24   0  12   6  12  12  18   6  24   0   0   6  24   3  12   0  12   6  30   9   6  12  24  12  12   0  15  18  12   0  18   0  24   6  15   6  18   3  18   3  12   6  24  12  12  12   6   0  36   0  18   3   6  12   6   9  12   0   3  12  36   0  30   0  12   0  18   6  12   9  12   6  24   3  18  12  15   9  24   0  18   6  18   9  18  12   6   6  24   3  24   0  12  12  12   0   6   0  27  12  18   3  30   3  18   6   0  12  15   6  18   0  24   0   9   6   9  12  18   7  24   0  24  12  15  12  24   0  24   0   6   9  30   9   6   6   0   9  33  12  36   0  12   0  18   0   6  21  12   6  36   6   0   3  18   6  12   6  24   0  12   3  24   6   9  12   6   6  30   6  18  12   9   9  12   0  30   3  18   3  27   6  30  12  12   0  24   0  27  12   6   0  24   3  18  18   9   6  18   0  12   3  33  18  12   9   6   0  12   6  30   0  24  12  12   0  30   6   6   6   0   6  24   0  12   0  18  15  33   6  30  15  18   0   9  12  24   9  12   0  18   6  27  18  15   6  18   3  24   0   6   6  36  12  18   0  12   3  30   3  12   6  12  15   6   0  18  12  15   9  30   0  18   6  12  12  18   6   6   3  24   1  27  12  18   6  18   0  24   0  18  15  15  21  30   6  12  12  18   0  30   6  24   0   6   0  18   6  36  12   6   6  36   0   6  12  12  12  24   0  30   0   9   6  18   0  18  12  12   6  24   6   9  15  12   0  12   6  30   9  18   0  42   3  18   6  12  18  33  12  12   0  18   0  21  12  12  12  24   6  30   0  27  18   6  12   6   0  24   0  18  15  30   0  18  12   6   0  21   6  21  12  24   0  30   0   6   6   6  12  24   0  30  12   9  12  21   3  24   0  12   3  21  18   9  18  18   6  30   3  42   6  21   6  30   0   6   3  24   9  36   6   6   9  12   6  18  12  33   9  12   0  24   9   9   6   3  18  36   6  18   0  24   6   6   6  18   0  12   0  30   3  39  12  12   7  18   0  15  18  18   9  36   0  24   6   6  18  30   0  18   9  18   3  24   6  21  12  24   0  30   3  33  24  12   6  18   6   6   6  18   6  18  12  18   0  24   6  36   3  18   6   0  12  30   0   9  24  18   0  24   0  18   0   0  12  30  15  30   6  18   3  30   0  24  18  12   0  36   3  24  12  15  18  18   6  24   3  24  12  18  12  24   0   0   6  39   6  24   3  18   3  42   6  12  12  15   9  30   0  12   0  18   6  18  12  24  15  12   0  12  12  30  12  12   0  18   0  15  15  18  18  30   3  24  12   9   6  48   0  18   0  30   0  21   6  12  12  24  12  18   3  48  24   6   6  18   0  36   0  12  15  27   6  12  12  18   6  27   6  12   9  18   0  24   6  18  18  21   0  36   0  12   0  18  12  21  18  24   0  12   1  18   9  21  18   6   9  42   3  36  12  12  12  30   0  12   6  21  12  36   6  24   9  12   6  12  12  24  12  18   0  42   0  15   6  15  15  42   6  30   6  12  12  18  12  18   0   6   6  36   0  30  18   6   0   6   0  30  18  18   0  42   0  18   6  15  18  24   0  12   6  36   9  33  12  12  12  18   0  36   0  21  21  15  18  18  15  18   0  18   6  42   6  24   0  18   3  42   6  18  12  12  12  18   0  15  12  18  12  36   0  30  12   3  21  18   0  30   6  24   0  27  12  18  12   6   0  12   0  36  15  15   3  36  12  18   6  30   6  33  12  12   0  12   6  24   6  54  18  12   3  36   9   9  12  12  18  36   0   6   0  21  15  27   9  24  12  30   6  24   6  27  18  12   0  30   0  21  12  18   6  30   0  18   0  21  18  21   6  30   0  24   3   6   6  15  27  12  10  42   6  36  12  12   6  24   0  24   6  12  12  48   6  18  12   0   3  51   6  30   6  24   0  24   0  30  21  15  12  24   9  18   6  18  12  30   9  24   0  18   0  27  18   9   6  18   9  54   0  18  24  21  18  12   0  24   0  12   0  30   9  30  12   6   9  24   6  15  15  18   0  30   3  33  18  21  12  42   3  30   6   6  24  27   6  12   0  24   3  42   6  42   9  12   6  18   6  24  12  12  12  54   0   6  12  18   6  18  18  30  12  30   0  18   0  27  18  24   0  18   0  15  24  21   6  24   3  36   6   6   6  45  21  18   0  18   6  33   3  18   0  24  15  30   0  30  24  12   6  36   0  24   3  21  24  18  15  30   3  12   6  42  12  12  12   6   0  54   6  30  15  24  18  24   6  12   0   9   6  30   0  48   0  24   0  15  12  39  12  24   6  24   6  15  30  12   6  24   0  24   3  24  12  24   6   6  18  12   4  54   6  21  18  18   0  36   6  24   9  30  12  24   9  36   6  12  18  42   3  30   0   6   9  21   6  12  30  30   6  30   0  27  12   9  18  30   0  36   0  18   9  42   6  24  12   0   6  51  12  24  12  12   0  18   6  12  18   6   6  36   3  54   9  18   6  27  12  18   0  30   0  39   9  18  18  12   9  30   6  21  12  27  18  24   0  12   0  42  18  42   6  24  15  18   0  24  12  45  12   6   0  54   0  15  21   6   6  30   6  18  12  24  18  30   6  36   0  12   3  24  12  18  18  18  12  24   0  33  12  27   6  42   0  18   6   9  15  30   6  30   6  12   6  18   6  33  15  30   0  36   3  27  21  33  24  30   9  24   0  12  18  33   6   6   0  18   3  57  12  24  18  30   9  18   0  18  12  27  12  36   0  36   6  12   6  27  12  30   9  24   6  39  18  12  24  12   0  30   0  30   6  15  15  18   3  24  18   9  12  30   9  30   0  18   6  42  18  30   0   6  10  48   0  24  12  12  18  48   0  30   3  30  15  18   6  24  18  18   0  42   6  36  15  24   0  42  12  21  24  12  12  24   0  12   6  18  18  60   6  30   0  12   0  24   0  12  18  30  15  42   0  33  30   6   6  12   0  42   3  27   6  33  12  36  12  18   0  30   6  18  12  12   0  18   6  15  27  27   6  42   6  36   9  18  30  33   9  30   0   6   6  54   6  36  24  24   0  30   3  12   6  21  24  30   0  24   0  24  12  42   9  42  21  12  12  27  12  27   6  12   0  48   6  12  18  12  12  36   6  30   0  24   0  42  12  12   0  36   0  24  15  21  21  18   6  12   9  36  18  18  15  42   0  18   6   9  18  48  12  30   9  24   3  33   6  18  18  18   0  36   3  54  24   3  12  36   9  36   6  30  12  36  12  24   0  18   6  24   6  42   0  24  18  18   0   9  30  39  12  42   0  36   0  12  12  21  12  18  12  24   6  45   6  18  24  18   0  36   0  42  15  18   6  24   6  12  12  18  12  30   6  18   0  30   1  30   9  57   9  12   9  48   6  21  24  18  12  66   0  18   6   9  24  24  24  30  12  18   0  48   6  24  18  18   0  24   3  27  18  24  12  36   6  48   6  15  18  42   6  24   0  12  12  36   6   6  24  12   3  48   0  48  18   0  12  18   0  36   6  18   9  54  15  12  12   6   6  39   6  24  18  42   0  30   0  33  18  24  18  18   9  18   0  15  18  54   0  36   0  24   0  48  24  15  18  18  12  42   9  24  12  36  21  30   0  36  12  24   3  30   0  48  15  12   6  15  18  18  18  24   0  30   0  24  24  18   9  72   0  30   6  21  18  30   6  24   0   0   6  24  18  42  12   6  15  36   0  30  18  30  12  24   0   6   0  18  12  54   9  36   9  36   9  30   6  27  27  24   0  54   6  21  18  21   6  36  15  36   3  30  12   6  18  30   0  18   6  54   0  30  21  36   9  30   6  30  24  24   6  30   0  36  12   9  24  24  12  18   9  30   0  48  12  24  12  12   0  48   0  18  12  24  24  30   6  18  12  21  12  24   0  66   0  12   0  30   9  24  24  18  13  42   3  18  18  27  24  24   0  30   6  15  18  39  12  12   9  36  12  54  12  42  18   6   0  36   0  51  18  12   0  66  12  24   0   6  24  51  12  24   0  24   0  33   6  18  18  30   6  42   3  18  30  15  15  30   0  30   6  30  12  48  12  24  12  12   9  36   6  36   6  12   0  30   0  24  21  24  15  42  12  24   6   9  18  15   9  42   0  24  12  66  12  30  24   6   9  54   0  36  12  21  12  36   0  24   3  24  15  36   6  30  24  12   6  33   6  39  21  30   0  42   6  12  30  30  18  36   0  48   3  36  12  30  18  18   0  24   0  30   6  33  21  24   6  18  12  24  12  12  15  48   0  24   6  21  21  60   6  24  12  18   0  30  12  15  12  24   0  24   3  60  27  18  12  30   3  24   9  21  12  60  18  24   0  24   9  33   6  36  12  24  15  42   6  27  36  27   6  42   0  42   6  12  15  15  24  42  18  12   0  33   6  21  18  24   0  48   3  36   9  24  24  30   6  36   0  39  18  60   6  18   0  12   6  21  27  30   0  18   6  42   6  42  18  24   9  48   0   6   6  18  18  18   6  18  15  30   4  60  12  30  30  18   0  36   0  27  18  30  18  48   9  30  12  18   6  42   9  48   0  18   6  42   6  30  24  12   3  36   0  36  36  15  18  30   0  66   0  12  18  42   9  24  15  18  12  54   6  18  21  36   0  30   6  24  24  12   6  24   9  36  12   6  12  45  12  36   0  36   0  48   3  24  18  12  24  36   0  30  12  30  21  30   0   6  15  18  15  66  12  42   3  12   0  39  12  30  12  18   0  54   6  30  24   9  12  60  12  30  12  30  24  24  18  30   0  36   0  27   9  45  18  24  12  24   0  36  24  12   6  60   0  18   0  24  15  51   9  24  12  30  12  27  18  51  18  24   0  36   6  27  27  12  30  36   6  30   0  12   6  42   0  18   0  18   0  48  12  45  24   6  15  42   6  12  18  27   9  54   0  42   3  33  12  15  12  54  18  30   6  36  18  21  30  18   0  48   3  30  18  36   6  18   0  18  12  57  24  42   6  24   0  18  12  36  18  30  12  36   3  78   0  24   6   6  36  42   0  24   0  21  15  33   6  42  18  12   3  30  12  30  27  24   0  42  12  39  12  30  12  30  15  30   6  12  24  54   6  24   0  18   6  33  12  18  24  24   7  30   0  60  24  21  12  30   0  48   6  18  15  39  12  18  18  18   0  48  12  54  18  42   0  30   0  15  30  27  18  72   0  30  15  12  12  30  18  36   0   6   3  60  15  24  18   6  18  54   6  21  24  24  12  30   0  30   6  30  15  54   6  48  12  30  12  36   0  24   3  24   0  54   6  18  30  15   6  42   9  36   0  21  30  15  12  12   0  24   3  72   0  51  39  24  12  30   3  33  18  15  12  42   0  30  12  27  24  51  12  42  12  18   3  42  12  39  18  12   0  30   0  24  21  21  21  30   6  66  12  12   6  69  21  30   0  24   6  45  12  12  18  42  12  18   0  39  30  33  12  54   0  12   0  12  18  36   9  30   9  24   9  60  12  30  12  12   0  42   9  42  18  45  24  42   6  12   9  24   6  30  12  42   0  30   6  15  15  30  12  18  12  54   6  21  30  12  33  60   0  48   0  30  15  42   6  24  24  30   0  36  18  33  18  12   0  60   0  72  15  12   9  30  12  24  15  21  24  51  12  24   0  24   6  12   6  33  24  36   9  54   6  27  24  30   6  48   0  24   3  36  27  42  15  18  18  12   6  54   6  30  15  36   0  12  12  18  24  21  18  30   3  60   0  33  12  36  18  48   0  24   1  39  12  24  18  24   9  66   6  48  24  12  12  42   0  24   6  18  12  63   6  36  24  18   0  39  12  39  24  24   0  54   6  15  24  15  24  48   3  36  12  12  24  39  18  36   0  42   6  42   6  60  24  12  18  18   0  45   6   6   6  72   0  30   6  24   9  36  12  24   9  30  15  36  18  33  24   6   0  54   0  33  36  18  24  36   6  18   6  24  18  75   6  18   0  18   0  48   9  36  18  42   9  30   0  27  36  24  15  42   0  42  18  36  12  18  12  72   9  24   0  54  18  21  24  12   0  60   0  24  24  39  12  42  18  30   6   9  12  48  12  30   0  18  12  36  15  48  18  18   3  42   6  42  18  18  24  54   0  36   0  24  36  42   0  12  27  30   6  60   6  30  24  12   0  36   3  42  12  18  12  36   9  30   0  15  18  33  12  54   0  30   6  33  21  27  30  42  12  54   9  42  24  27   6  36   0  24  12  24  12  45  24  12   6  30  12  69  12  42  12  30   0  24   0  42  18  24  15  60   9  48  18  18  24  27  12  36   0  30   0  54   9  30  18  24  15  48   0  24  24  45  24  24   0  18   6  36   9  54  15  24  12  12   6  18  12  54  18  12   0  60   3  48  30  12  18  60   6  24   3  36  12  33  12  36   0  36   6  36   3  33  24  12  13  42  12  27  18  30  12  54   0  30  12  21  39  54   6  54  18  18   0  33  12  36  36  36   0  30   0  42  33  18  18  36  12  30   3  30  12  66   6  30   0  18  12  63  18  24   6  30  12  48   9   6  24  30  12  42   0  72   0  30  12  48   3  24  15  12  12  66  18   9  36  12   0  54   0  54  18  15  30  36   6  12   0  21  18  54  12  30   0   6   0  36  15  60  18  18  15  48   6  27  24  21  12  54   0  54   9  12  24  48  12  48  15  54   6  36   6  39  24  24   0  24   3  33  24  18  18  66  12  18  12  30  12  75  15  36   0  30   9  24   6  21  24  24  12  60   0  66  36  12  18  36   0  24   6  30  18  39  18  30  12  24   9  30   6  36  18  18   0  54  12  33  24  36   6  66   0  30   6  12  12  33  24  54   0  18   3  60   3  30  24  24  21  48   0  18  30  51  12  18   0  30  12  33  15  18  12  30  27  24   0  48  12  45   6  30   0  72   0  51  18  27  27  54   9  48  12  27  30  36  18  18   0  42   3  36   9  45  30   6   6  36   3  51  24  24  18  72   0  18   6   9  36  42   0  36   9  30  12  60  30  24  15  24   0  36   6  30  27  27  18  42  12  48   0  42   0  33  24  24   0  30   0  42  12  48   9  36   9  24   6  27  36  12   9  60   0  30  12  15  18  42  18  36  18  24   7  48  12  54  24  30   0  78   0  18  18  27  24  24   6  30  12  33  18  60  15  54   0  12  12  36  12  36  24  30  18  54   0  18  18  18  24  84   0  54   0  27  15  42   6  36  12  18   9  54   6  30  30  24   0  30   9  60  30  36   6  42  12  30   6   6  30  60   0  18   0  24   9  51  18  24  33  30   0  42  12  60  18  18  36  18   0  24   0  18   9  78  12  48  24  12   0  48   6  12  18  42   0  48   0  30  27  18   6  48   3  66  21  18  18  33  12  48   0  30   6  63  21  18  36  24  15  60   6  36  30  36   0  48   0  48   3  36  30  42  18  24  24  12   6  21   6  72  12  36   0  60   6  12  18  15  24  60   9  30   0  39  30  54  12  18   0  18   3  60   9  57  24   6  18  48   6  60  18  18   9  48   0  24  12  18  18  39   6  42  15  36   6  36  18  18  30  18   0  42   6  39  27  27  18  48  12  42  12  24  18  27   9  30   0  24   9  81  12  72  12  30   6  36   0  33  42  39  30  42   0  12   3  12   6  24  18  48  12  48   3  63  24  24  27  30   0  78   6  36  18  36  30  30  12  36  12  30   6  60  12  48   0  24   0  36  21  30  24  30  12  48   0  36  12  24  27  36   0  42  12  27  24  54   6  18  12  48   0  30   6  72  24  12   0  30   3  45  24   0  18  78  15  18  18  39  18  39   9  36   0  24   6  39  12  30  18  30  16  48   0  36  30  12  12  60   0  42   3  24  21  84  33  30  12  18  18  48  12  36  12  30   0  48   9  42  36  42   6  48   3  42   0  33  24  30  12  36   0  36   6  54  12  30  30   6  21  66   0  39  24  36  24  36   0  24  12  30  15  54  12  78  30   6   0  33  12  27  30  30   0  36   6  18  36  36   6  66   3  60   6  18  30  42   0  12   0  36   6  54   6  33  24  24  12  54   0  42  12  15  12  60   0  30   0  21  18  75  18  48  18  18  15  30  24  42  33  36   0  30   6  45  24   9  30  36   3  54  15  24  18  63  18  42   0  24   0  75   6  30   9  30  15  42  12  33  36  21  24  60   0  54   9  30  30  48  12  18  12  24   0  66  12  24  18  36   0  72   6  36  15  27  27  30   6  12  18  24   6  78  15  42   0  12   6  27  24  51  18  36  12  60   3  51  30  12  24  36   0  30   0  48  12  21   6  36  24  54   6  42   6  36  36   6   0  54  12  27  15  18  18  66   6  42   0  15  30  63  12  48   0  36   3  63  12  36  30  18   9  48   3  48  36  30  12  42   0  72   6  36  30  30  12  24  12   6  15  75  18  30   6  36   0  24   0  18  36  48  18  60  18  60  12  33  12  33  15  72   0  18   9  54  15  21  30  36  12  30   0  42  24  48  18  36   0  24   6  18  15  81  12  12  27  36  12  30   6  36  18  24   0  48   6  36  36  27   6  48   9  36   3  36  36  36  24  30   0  24   1  42   6  66  27  24  18  48  12  51  18  24  18  84   0  24   6  12   9  63  18  48   9  30   0  36  12  33  24  30   0  72   0  42  48  36  18  42  12  42  15  24  12  60  15  24   0  12  21  72   3  42  30  24  18  36   6  42  18  30  12  42   0  48  12  12  24  24  18  66   6  24   0  93  12  51  30  12   0  54   6  18  27  24  24  36  12  30   0  45  18  60   6  54   0  24   0  51  24  21  18  30   6  72   6   6  18  21  36  42   0  48  12  27  24  36   6  30  27  30   6  39  18  51  36  30   0  42   0  66  18  36   6  66   9  24  12  24  24  78  12  36   0  36  12  60  15  42  24   6  15  54   0  33  30  21  30  42   0  54   0  24   9  60   9  36  24  24   6  66  12  48  18  54   0  30   0  30  39  30  18  48   6  42  12  33  24  33  12  60   0  18   6  42  24  42  24   6  12  72   6  42  30  18   9  30   0  24  15  30  18  60  12  54  15  24   0  48  24  33  12  36   0  66   6  36  18  21  30  72   3  24   9  27  30  30  18  42   0  42   0  72   6  39  42  24  18  60   3  24  18  36  18  30   0  54   6  27  33  60  12  24  24  18  18  30  12  21  33  48   0  78  12  78  12  30  12  42  12  48   0  24  12  75  18  24   0  18   0  33  24  30  21  42  15  30  12  39  30  51  12  54   0  36  12  18  12  48  24  78  18  18   6  78   6  24  30  12   0  42   0  45  18  15  27  42   0  54  18  36  18  36   6  48   0  30  12  36  21  45   6  24   7  54   0  27  42  33  24  72   0  42   0  48  24  45  18  18  15  36  15  66   6  66  30  18   0  48   0  27  39  30  18  66  27  12  12  18  24  60   6  66   0  42   0  42   6  33  21  36  12  42   6  21  36  33  21  48   0  66  12   6  18  75  24  36  12  18   0  81  12  42  30  36   0  24   0  30  30  30   6  60   9  60   6  24  30  30   6  30   0  30  12  75  18  30  24  24  15  78   0  42  24  18  30  42   0  30  12  21  12  48   9  60  21  30  12  24  24  39  21  24   0  54   3  39  30  33  24  72  12  60   0  18  24  57  12  24   0  24   3  90   9  12  21  36  12  30  18  84  24  30   9  60   0  36  18  18  24  78  18  24  18  48   6  24   0  45  30  24   0  66   3  60  36  21  42  42   6  30   6  33  12  60  21  36   0   6   6  36  15  36  30  48  21  48   0  39  36  36   6  54   0  66   3  18  18  33  24  36  18  30   9  66   6  15  36  24   0  96   6  30  12  42   6  36   6  36   9  27  36  42  12  42   0  18   6  51  12  78  18  30   9  54  12  39  24  24  33  66   0  36   9  45  33  36  12  18  27  36   0  78  12  48  24  30   0  42   9  48  21  18   9  60  12  54   6  21  24  72   3  66   0  18  18  33  12  21  36  36   6  36   6  60  36  36  18  48   0  24   0  30  24  87  24  24  27  42   6  60  18  66   6  18   0  36   6  39  36  30  18  36   9  30   0  18  18  51  12  48   0  54   0  48  18  36  30  36  30  66   3  12  18  15  39  60   0  24  12  66   6  54  12  48   6  18   7  30  24  48  18  30   0  84   0  30  48  12  15  60   9  42  18  42  18  42  18  48   0  30   9  48  21  69  36  12  12  48   0  57  18  24  24  66   0  36   6  24  21  69   6  54  12  30  18  72  18  30  30  18   0  42   0  42  42  12  18  42   6  54   9  42  12  72  18  24   0  24   3  78   0  24  24  30  15  60   6  42  30  39  21  36   0  54  12  27  24  42  24  72  21  30   0  48  18  24  30  12   0  30   3  24  15  72  33  42   6  24  24  12  24  66  12  60   0  24   6  63  12  42  18  24  18  84   6  30  24  24   6  90   0  72   6  21  24  30  18  18  30  24   6  66  18  54  18  36   0  36  12  60  27  30  18  90  18  18   0  18  24  48  24  30   0  36   6  36  18  66  36  30   3  66   3  57  48  12  18  36   0  48   6  36  21  48   0  60  12  36  12  72   0  36  30  30   0  48   0  33  30  48   9  54   9  36  24  18  30  42  18  54   0  12   0  54  12  21  24  30  21  72   0  66  24  27  18  36   0  24   0  45  24  78   0  42  21  24  12  39  30  54  30  24   0  84  15  24  24   9  30  54   9  48   6  33  18  57  18  30   0  60   3  54  27  33  30  36  24  42   0  54  18  39  24  54   0  60  18  24  15  75  12  24  12  42   0  39  12  36  36  36   0  30   3  66  42  15  24  72  12  48  12  42  12  48  15  24   0  18  18  60   6  60  18  36   9  24   6  27  36  30  24  90   0  60   3  21  18  54  24  48  18  18  12  51  24  39  18  18   0  72  12  42  21  36  24  36   6  36   0  33  18  42   0  60   0  18   6  42  21  39  39  36  13  84   6  24  18  30  24  78   0  36   3  54  39  51  18  30  21  24   3  60  12  87  42  30   0  36   6  30  15  36  12  54  18  42  12  27  24  84  15  42   0  18   9  54  18  30  30  48  12  72   0  54  42   9  12  36   0  60   0  27  21  78  18  42  30  30   6  54   6  30  18  24   0  60  12  42  36  48  24  54   6  36  15  12  48  21  12  30   0  36   0 102   6  18  12  24   9  60  12  48  24  33  30  66   0  30  12  30  15  60  12  54  36  30   0  36   6  72  18  36   0  54   0  30  36   9  15  60   0  60  15  39  12  63  18  42   0  30  18  60  21  57  30   0  18  54   3  75  30  48  24  42   0  24  12  36  42  57   9  48   9  36   6  45  12  24  48  54   0  66   0  45  33  30  18  54  18  36   0  36   6  54  30  54   0  36   0  66  12  42  21  24  18  48   6  21  48  42  12  60   0  84  12   0  12  54  24  36  18  18  12  81  18  33  18  12   0  66   3  66   6  33  48  48   6  24  24  36  18  60   6  36   0  24   6  39  21  42  18  42  12  60   0  24  30  33  36  72   0  30   0  36  36  42  12  36  15  24  15  75  30  63  27  24   0  42   6  63  30  18  12 108   9  48  12  24  12  72  18  30   0  54   6  30   9  63  27  48  15  36   6  48  36  18  12  54   0  42   9  36  36  63  18  36  24  36   0  75   6  63  24  36   0  48   6  27  39  30  18  30   9  54  18  36  18  39  21  66   0  30   0  54  18  42  36  12  24 108   0  30  24  42  12  48   0  24   0  15   9  48  18  66  24  24  12  54  12  36  21  54   0  54  18  45  42  36  24  42   3  36   0  42  48  42  12  36   0  36   1  60  18  36  18  36  15  54   9  60  30  24  21  48   0  24  18  24  18  90   6  72  15  36   9  48   6  36  42  48   0  78   3  54  27  18  36  48  15  54  12  30  24  84  12  18   0  18  12 105  12  24  30  30  18  36   0  60  30  27  12  48   0  90   6  18  18  33  21  42  24  24  12  45  24  60  36  36   0  66   6  27  15  42  24  60  12  18   9  30  18  84  12  72   0  12   6  42  21  45  12  18   9  96  12  21  30  30  24  66   0  48  12  42  18  36  18  24  24  24   0  30  12  27  42  18   0  72   0  84  27  54  15 102  12  36   6  39  36  36  15  36   0  30  15  57  12  57  42  30   9  60   6  27  42  27  30  36   0  54   6  24  21  78  12  42  18  18  12  84  18  54  18  48   0  66  12  15  36  30  18  72   9  66   0  27  18  24   6  78   0  42   6  81  27  27  36  24  24  48   0  72  18  39  30  42   0  18  18  30  24  78   6  18  18  36   0  48  30  84   6  18   0  54   0  42  36  12  30  90  12  48  18  24  18  21  18  48   0  60   0  60   6  30  42  24  18  66   0  27  36  24  18  54   0  48   6  30  18  90  15  42   9  48  18  42   6  45  24  36   0  48   0  78  39  27  12  42  27  48   6  45  18  72  36  48   0  18   9  66   9  54  33  18  18  66  12  39  36  45  12  72   0  48  12  21  39  33  18  60  18  36   0  78  18  39  36  24   0  30   0  30  30  54  21  66   6  30  21  39  18  60  15  72   0  30  18  45  12  39  18  60   6  66  15  36  30  12  18  60   0  60   0  18  33  57  18  24  24  42   6  66  12  81  42  18   0  36   6  42  18  24  24  72   0  18   0  30  30  87  18  36   0  42   3  45  12  36  42  24  25  30   6  72  24  18  18  60   0 102  12  42  12  90  12  24  27  24  12  69  24  30  18  42   0  48   0  42  45  39  15  60  18  30  12  33  24  72  18  36   0  24  12  51  24  39  36  24   6 120   0  72  24  30  30  30   0  24  12  72  18  54   3  84  30  30  21  42  24  30  18  30   0  54   0  36  30  24  30  72   9  72   6  30  24  36  24  30   0  30   0  90  12  48  27  24   6  54  12  39  36  18  18  78   0  36  12  18  39  66   6  54  18  36   0  54  18  42  12  30   0  78   0  48  45  27  36  36   9  54  15   6  12  99  15  48   0  24   3  60  12  45  36  36  30  24  12  57  30  42  18  54   0  36   6  45  24  63  30  60  12  42   6 102  18  30  33  18   0  84  12  54  24  39  12  42   0  36   0  54  24  60  12  42   0  48   6  30   9  93  24  18  21  60   6  21  36  18  54 102   0  30  18  36  21  48  12  30  27  42   3  54  12  66  36  36   0  48   9  45  33  30   9  84  18  30  12  33  36  51  12  54   0  36  18  42  12  30  36  24   9  72   0  48  30  36   6  78   0  42   0  18  24  63  21  36  18  24  15  66   0  42  27  54   0  30   9  51  45  45  24  48  12  72  12  33  24  39  30  66   0  18   6  69  12  36  24  36  18  90   6  60  24  36  27  36   0  60  18  33  21  84  12  36  30  18   0  33  24  51  30  24   0  84   0  57  33  36  21  84  12  30  12  33  36  63  18  24   0  30   6  90  21  66  30  30  24  36   0  54  12  51  18  78   0  36   0  18  18  54  21  48  12  66  18  21  18  33  21  42   0  66   6  48  54  21  30  66  12  66   0  24  24  63  24  36   0  42   3  60  18  30   6  36   9  54   6  72  48  36  15  54   0  30  27  12  18  60  12  66  15  48  10  84  12  39  42  12   0  66   6  24  18  21  36  54  24  24  12  51  18  66  12  90   0  18   6  87  15  75  24  30  15  60   0  24  42  24  24  48   0  84   6  51  39  60  12  18  30  36  12  60  12  60  48  36   0  54   6  42  12   6  18  78   6  48  12  12  36  84   0  48   0  54   3  48  18  45  51  54   6  72   6  51  30  45  30  48   0  36   6  36  15  78  24  42  24  24   0  90  18  36  24  24   0  36   0  36  30  30  30  66   6  78  21  30  12  21  15  60   0  36  12  66  21  36  24  30  18  60   9  54  48  24  18  48   0  30   6  42  18  81  18  54  27  24  12  30  18  84  30  24   0 102   9  42  42  36  24  90   3  30   0  60  30  42  18  24   0  18   0  78  12  42  27  42  18  66  18  45  18  42   9  84   0  54   6  15  54  63  18  54  24  24   9  57  24  45  54  36   0  60   0  66  27  33  18  30   9  60  24  30  12  54  21  24   0  12  18 108  15  66  12  30  27  66   0  36  30  36  24  66   0  60   0   9  24  54  12  90  15  42   0  51  30  18  30  48   0  84   9  48  21  54  30  24  18  36  12  45  18  96   6  30   0  30   9  30  24  42  24  24  15  66   6  69  36  15  15  84   0  36  15  48  27  45  18  42  30  36   0  66   6  72  30  48   0  42   3  51  39  30  33  78  12  24  18  30  18 105  21  72   0  42  12  39  18  27  42  24   6  66   3  60  42  30  30  60   0  54   6  54  24  57   6  54   6  24  24  54  12  57  27  42   0  48   6  36  27  57  12  84  12  60   0  12  30  54  24  48   0  18   3 105  36  48  42  24  18  48   6  30  36  45  42  42   0  54   9  36  12  48  12  54  30  30   6  48   6  51  18  36   0 102   6  18  30  33  24  48  18  60  12  60  30  45  12  36   0  54  12  60   6  48  54  12  13  60   0  72  18  24   6  90   0  48  12  15  42  96  18  36  18  36   6  78  24  48  18  30   0  48  18  78  42  24  30  60   6  60  12  18  12  42  30  42   0  24   0  81   9  54  18  60  33  48   0  27  54  51  27  90   0  60  18  24  18  54  24  36  12  42   0  87  24  33  18  24   0  96   0  87  36  30  15  42  12  36  24  24  36  42  21  48   0  30   6  42  18  48  24  24  18  84   3  36  42  42  36  72   0  54   6  30  15  60   6  78  30  24   6  72   6  66  45  24   0  42  21  36  30  36  18  48  12  30   0  39  24 102  18  36   0  12   6  54   6  30  33  66  21  90   3  78  36   9  18  36   0  84   0  30  30  93  24  30  24  30  15  63  12  48  30  54   0  48   0  54  42  42  30  78   0  36  24  39  24  60  12  78   0  60   6  51  30  36  36  30  18  60   0  30  30  51  24  60   0  42   3  24   9  54  21  24  33  30  24  66  24  69  18  30   0 102  15  54  24  15  30 120   6  30   3  51  24  54  12  30   0  36   6  36  12  90  42  12  12  60  12  60  24  42  12  90   0  24  12  42  30  30   6  78  21  42   0  54  24  27  54  24   0  66   6  45  30  12  30  42  12  84  15  36  18  84  24  36   0  30  18  72  18  60  24  48  12  54   6  36  54  42  12  42   0  60   0  51  48  54   9  36  27  24   6  84  18  48  30  42   0  78   0  48  27  27  48  42  18  36   0  39  18  99  24 102   0  18   0  48  18  72  15  36  12  84  12  24  12  30  39  84   0  36  12  39  39  63  24  42  24  66   6  72  18  18  24  30   0  60   6  48  42  36  15  78   6  48  30  12  36  54  12  36   0  42   6  45   6  69  24  72  21  48   0  57  48  12  24  48   0  48   3  48  15  78  24  60  18  12  12 111  24  54  24  24   0  48   6  36  33  42   6  54   9  72  18  27  30  30  12  54   0  66   4  78  21  24  54  18  24  54   6  60  24  54  21  78   0  36  18  54  30  66  18  48  30  24   0  42  12  99  36  30   0  90   6  18  30  30  24  78   6  66   9  24  42  78  30  42   0  18  12 102   6  33  24  18  12  66   9  54  24  24  36  84   0  60   6  39  15  78  12  42  21  42  18  42  18  18  42  24   0  48   3 105  51  42  30  42  18  72   0  24  24 102   6  36   0  36   9  99  12  48  21  48  18  42   6  36  42  18  12  78   0  48  30  30  18  36  30  42   9  42   6  60  12  39  30  24   0  78   0  48  30  39  27 102  24  30  12  51  12  66   9  48   0  30  18  45  39  87  30  36   9  72   0  60  24  30  36  54   0  48   0  45  36  45  18  42  27  60   9  66  12  78  42  18   0  60   6  60  33  36  24  96  12  18  12  12  36  72   0  78   0  36   6  60  24  27  51  42  24  84  12  57  48  30  24  42   0  60  12  24  18  96  12  30  30  30   0  93  18  48  18  60   0  48   6  54  36  30  12  42   9  60  18  12  24  69   6  60   0  54   6  33  15  60  36  30  18  90   3  72  24  54  54  42   0  18   9  60  30  84  18  48  24  12   6  66  36  24  27  24   0  42  12  39  42  27  18 108   9  78   0  48  12  54  30  30   0  36   0  48  12  75  39  30   6  42   9  66  30  33  18  96   0  48  18  39  36 102  12  54  18  24   9  45  24  72  30  36   0  78   6  63  36  36  21  60   9  36  12  54  24  78  27  42   0  42  18  60   9  24  24  54  39  84   0  27  36  39  12  84   0  66   0  21  30  30  42  66  18  18  18  78  12  48  42  36   0  90   6  48  33  39  24  48  15  54  15  54  24  48  18  60   0  24   0  48  24  78  24  36   9  90  12  42  24  30  45  54   0  66  12  24  12  60   6  48  33  48   0  60   6  51  54  12   0  30   0  69  21  42  15  72  15  48  21  33  36  96   6  30   0  54   6  87  30  42  30  36  13  42   6  84  48  18  18  72   0  54  12  30  30  75  24  36  24  42  18  78  12  36  30  72   0  48   6  33  36  57  36  66   6  54   0  27  36  66  12  90   0  24   3  96  24  27  24  18  24 108  12  42  48  24  18  30   0  54  18  48  12  75  18  90  21  36  12  72  12  45  24  24   0 114   0  27  30  39  33  48  12  54  12  18  42  45  27  48   0  48   6  90   9  60  42  36  12  48   0  36  42  42  18  78   0  30   6  24  33  78   9  84  30  18  15  63  18  51  30  48   0  72   6  36  51  24  30  48  21  96   6  24   6  93  12  48   0  18   6  69  18  36  18  24  18  24   6  54  36  51  33  96   0  36  15  27  30  54  30  42  12  36   0 117  36  54  36  24   0  96   3  72  36  57  27  54   6  54  21  36  12  66  33  60   0  30  24  24  15  63  30  42  24  78   9  39  30  24  24 138   0  42   0  54  24  57  12  30  24  42  18  54   6  60  33  24   0  72   6  84  24  42   6  66  15  36   0  42  48  51  18  66   0  60   3  60  12  60  57  42   9  72  12  60  42  27  24  60   0  42  18  24  30  48  30  36  18  30   9  78  12  51  18  30   0  60   0  12  57  51  18  78   6 102  12  30  24  48  27  36   0  30  12 126   6  27  36  30  18  66   0  60  30  48  36  48   0  24   6  39  24  96  12  90  33  36   6  39   6  90  27  36   0  60  12  45  42  30  30  72  12  36   9  39  36  69  24  48   0  36   6  66  15  72  39  36  27  54  18  57  30  42  12  60   0  84  24  36  27  72  12  48  21  60   0  51  30  27  30  90   0  78   0  42  57  12  30  48  18  42   6  48  24  90  15  42   0  12  15  84  24  72  18  48  21  66   3  54  42  30  24  48   0  36  18  27  12  42   9 108  18  36  12  96  24  21  30  24   0  96   9  54  18  75  30  54  18  36   0  39  18  84  18  42   0  24   6  54  18  57  42  24   9  84  18  48  42  27  30  78   0  60   0  30  48  36   6  30  36   6  10  78  12  51  48  48   0  90   0  75   9  42  24  48  15  72  12  33  42 108  12  54   0  54  18  51  42  36  48  48  12  72   0  42  18  45  30  66   0  78   3  36  15  78  30  30  30  30  15 102  12  54  18  30   0  36   6  81  48  12  24 108   6  78  18  24  36  33  18  30   0  30   0 108  21  54  42  18  18  90   6  30  48  69  36  48   0  24  15  24  15  84  24 114   6  30   0  48   6  60  42  24   0 102  12  42  42  27  21  78   9  42  24  51  24  42  12  48   0  60  12  66   6  42  24  30  24  42   0  78  24  54  12  66   0  30   6  24  51  99  18  60  24  42  18  54   6  45  60  36   0  54   6  39  39  39  30  66  18  72   0  51  24 102  12  54   0  24   0 102  12  48  24  42  36  60   0  12  48  18  12  54   0  84  18  39   9  84  30  66  18  48  15  72  48  39  42  48   0  60   0  84  30  45  33  54   6  54  30  33  30  90   6  54   0  24   6  72  27  78  12  24  15  66   0  54  36  21  42 114   0  60   3  30  33  54  27  30  33  60   6  54  12  48  33  36   0  42  12  45  39  24  36  96  18  24  12  33  18  99  18  66   0  36   0  51  24  30  30  36  15  84   6 102  48  48  18  60   0  72  12  36  42  60  12  24  21  30   0  54  18  60  18  42   0  66   6  24  24  54  15  78  12  42  27  27  30  51  27  78   0  48   6 120  27  48  42  24  12  54   6  54  24  48  36  66   0  78   9  57  21  48  18  54  33  24  30  84  18  45  33  30   0 126   9  36  30  27  30  66  18  54   0  36  42  48   6  42   0  54   6  57  12  84  54  48   6  60   6  63  18  42  36  78   0  24  24  33  24 105  24  66  27  48   0  48  30  60  30  54   0  42   3  75  48  24  12  66  12  96   6  30  12  87  21  36   0  30  24  69  12  57  30  48  24  54   0  42  54  24  24  72   0  60   0  48  24  69  24  42  18  36  12  66  24  36  42  18   0  78   9  48  36  42  42  36  12  36  21  78  18  48  12 102   0  18  12  54  24  45  27  42  13 108  12  39  24  42  27 102   0  60   6  39  24  54  12  54  24  24   0 114  24  63  48  30   0  48   6  69  36  18  12  72   6  48  18  33  54 117  12  42   0  66  12  48   6  54  36  42  21 102   6  48  54  33  30  48   0  72   0  30  24  75  24  84  30  30   0  72  18  30  42  54   0  60  12  36  45  42  12  96   6  66   0  12  36  78  36  42   0  36   0  78  24  48  24  18  30  90  15  96  18  27  21  54   0  24  21  48  27  84  18  48  42  36   6  66  12 108  12  42   0  48   9  27  60  21  36  84   6  36  18  42  18  54  18  60   0  60  15  72   9  99  42  12  12  60   0  57  42  18  18  78   0  42   6  36  36  63   9  42  15  30  18  78   6  24  48  42   0 102  12  75  45  42  30  84  24  66   9  24  30  90  24  42   0  24   3  84  21  84  33  66  24  36   6  36  48  51  18  72   0  66  18  54  30  24  18  48  18  30   0 102  12  45  36  24   0 102   3  42  15  42  54  54  21  66  24  66  30 102   3  66   0  48  12  24  30  45  36  54   6  78   9  48  24  39  36  96   0  66   6  27  27  60  30  18  30  48  12  90  24  60  36   6   0  42  12  78  36  36  24 114   6  60   0  18   6  69  18  84   0  36   6  48   6  39  24  42  24  54   6  72  48  36  42  60   0  48   0  36  18 138  24  30  30  42  18  75  18  48  18  24   0  78   0  78  57  60   9  48   9  36  30  30  42  42  39  84   0  24  12  87  27  30  42  24  24  90   0  36  24  60  36  84   0  42   0  30  21  87  12  72  24  42  12  60  30  72  21  60   0  96  12  30  42  39  18  66  12  84  12  63  42  42  24  42   0  18   6  78  15  75  45  54  12  54   6  84  30  30  18  54   0  42  24  39  27  96  18  42  21  48   0  54  18  33  36  66   0  84   0  75  48  30  42  54  12  54  15  42  30  96  18  42   0  18   6 123  15  48  24  48  39  42   6  21  54  45  12  60   0  90  12  30  36  45  18  72  21  78  12  30  12  60  30  18   0  78   6  60  36  33  18  60  12  30   0  60  18  90  30  54   0  36   1  78  27  84  30  18  15 102   9  27  30  24  57  90   0  42   9  48  42  42  12  72  27  48   9 108  18  48  48  18   0  84   6  66  24  48  21 114   6  78  24  30  30  42  18  60   0  18  12  63   9  51  66  48  15  54   0  66  60  36  18  48   0  66   6  36  30  96   9  36  30  30  24  93  24  72  24  66   0  60  24  48  30  24  30  72   6  60  12  30  12  93  18  72   0  30   0  81  30  36  48  36  30  90   6  54  24  57  24  36   0  54  18  36  24  78  18  72  33  12   0  51  30  48  24  42   0  90   3  78  30  30  27 138   6  30  18  36  24  75  24  12   0  54  12  42  18  84  36  30  18  66   6  45  36  36  48 114   0  24   6  30  21 108  15  48  18  36  18  57  24  63  42  54   0  78   6  81  36  18  24  42  18 120   0  24  24  66  12  54   0  48  12  66  18  42  36  48  18  72   6  48  48  33   6 102   0  54  24  39  54  60  12  90  18  36   3 111  24  51  48  42   0  90   0  45  36  54  48  54  24  18  18  51  18  72   0  54   0  18  12  54  36  57  18  42  18 120   0  63  42  27  36  48   0  54   6  39  30  81  18  72  33  54   9  72  12  54  54  24   0  54  15  75  24  60  12  78   6  30  12  39  54  72   6  54   0  72   6  78  12  54  39  30  15  48   6  57  48  18  24  90   0  90  18  42  24  39  42  24  30  42   0  84   6  66  30  30   0  30   0  27  42  39  33  90  24  84  18  51  36  69  24  54   0  42  18  87  33  51  18  42   9 126   9  84  36  66  18  54   0  36   0  66  12  48  15  54  30  18  18  60  18  96  54  42   0 102   0  27  36  30  36 108  15  54   0  24  36  60  24  66   0  30   0  54  15  75  48  36  18  48  24  36  36  54  15 108   0  84  18 ";
int main(){
	char ch[6];
	int n = 0;
	read(0, ch, 6);
	for(int i = 0; ch[i] != '\n'; ++i) n = n * 10 + (ch[i] - '0');
	write(1, ans, n * 4);
}


//AC
#include <stdio.h>

int main(void){

    int N;
    scanf("%d",&N);

    for(int n=1;n<=N;n++){
        int count=0;

        for(int i=1;i*i+2*i<=n;i++){
            for(int j=1;j*j+2*j<=n&&j<=i;j++){
                for(int k=1; k*k+2*k<=n&&k<=j;k++){
                    if(i*i+j*j+k*k+i*j+j*k+k*i==n){
                        if(i==j&&i==k){count++;}
                        else if(i!=j&&j!=k&&k!=i){count+=6;}
                        else{count+=3;}
                }
            }
        }
        printf("%d\n",count);
    }

    }

}


//AC
#include <stdio.h>

int main(void){

    int N;
    scanf("%d",&N);

    for(int n=1;n<=N;n++){
        int count=0;

        for(int i=1;i*i+2*i<=n;i++){
            for(int j=1;j*j+2*j<=n&&j<=i;j++){
                for(int k=1; k*k+2*k<=n&&k<=j;k++){
                    if(i*i+j*j+k*k+i*j+j*k+k*i==n){
                        if(i==j&&i==k){count++;}
                        else if(i!=j&&j!=k&&k!=i){count+=6;}
                        else{count+=3;}
                }
            }
        }
        printf("%d\n",count;
    }

    }

}


#include <stdio.h>

int main() {

    int a, i, x, y, z;
    int res[100001] = {};

	scanf("%d", &a);

	for (x = 1; x * x + 2 * x < a; x++) {
        for (y = 1; y * y + 2 * y < a; y++) {
            for (z = 1; z * z + 2 * z < a; z++) {
                res[x * x + y * y + z * z + x * y + y * z + z * x]++;
            }
        }
    }

	for (i = 1; i < a; i++) {
        printf("%d\n", res[i]);
	}

	return 0;
}


"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var n = next();
  var ans = xArray(0,n);
  for(var x = 1; x*x <= n; x++){
    for(var y = 1; y*y <= n; y++){
      var xy = x*x + y*y + x*y;
      if(xy > n)break;
      for(var z = 1; z*z <= n; z++){
        var f = xy + z*z + y*z + z*x;
        if(f > n)break;
        ans[f-1]++;
      }
    }
  }
  return ans.join("\n");
}


"use strict"

const { sign } = require("crypto");

const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function () { return this.index < this.max },
        "next": function () { if (!this.hasNext()) { throw "ArrayIndexOutOfBoundsException"; } else { return this.list[this.index++]; } }
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)

const Main = () => {
    let n = nextInt()
    let a = new Array(n).fill(0)
    for (let x = 1; x * x < n; x++) {
        for (let y = 1; y * y < n; y++) {
            for (let z = 1; z * z < n; z++) {
                const sum = x * x + y * y + z * z + x * y + y * z + z * x;
                if (sum > n) break;
                a[sum - 1]++;
            }
        }
    }
    console.log(a.join(`\n`))
}
Main()


var GET = (function () {function f(s) {return new g(s);}function g(s) {this._s = s.trim().split("\n");}g.prototype.getValue = function (n) {return this._s[n];};g.prototype.getArray = function (n) {return this.stoa(this._s[n]);};g.prototype.slice = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stox(v));};g.prototype.sliceArray = function (s, limit) {return this._s.slice(s, +limit + s || undefined).map(v => this.stoa(v));};g.prototype.stoa = function (s) {return s.split(" ").map(v => this.stox(v));};g.prototype.stox = function (v) {var i = +v;return (i === i) ? i : v;};return f;})();
var o = GET(require("fs").readFileSync("/dev/stdin", "utf8"));

console.log(main());
function main(){
    var N = +o.getValue(0);

    var result = Array(N).fill(0);
    for(var x = 1; 100 > x; x++) {
        for(var y = 1; 100 > y; y++) {
            for(var z = 1; 100 > z; z++) {
                var n = x**2 + y**2 + z**2 + x*y + x*z + y*z;
                if (N >= n) {
                    result[n - 1] += 1;
                }
            }
        }
    }

    return result.join('\n');
}


function Main(input) {
	n = input
	for (i=1;i<=(n);i++){
		var cnt=0;
		for (x=1; x <= 100; x++){
			for (y=1; y<=100; y++){
				for (z=1; z<=100; z++){
					var eq = x**2 + y**2 + z**2 + x*y + y*z + z*x;
					if (eq === i){
						cnt++;
					}
				}
			}
		}
		console.log(cnt)
	}

}

// var input = "20";

// Main(input);

// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function Main(input) {
	n = input
	for (i=1;i<=(n);i++){
		var cnt=0;
		for (x=1; x <= 100; x++){
			for (y=1; y<=100; y++){
				for (z=1; z<=100; z++){
					var eq = x**2 + y**2 + z**2 + x*y + y*z + z*x;
					if (eq === i){
						cnt++;
					}
				}
			}
		}
		console.log(cnt)
	}

}

// var input = "20";

Main(input);

// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


//let input = "20";

function main(input){
  input = input.trim();
  let n = parseInt(input);
  let count = 0;
  for(let i = 1; i<=n; i++){
    count = 0;
    let kaisuu = Math.floor(Math.sqrt(i));
    for(let x = 1; x<=kaisuu+1; x++){
      for(let y = 1; y<=kaisuu+1; y++){
        for(let z = 1; z<=kaisuu+1; z++){
          if(x*x+y*y+z*z+x*y+y*z+z*x===i){
            count++;
          }
        }//z
      }//y
    }//x
    console.log(count);
  }//i
}
//main(input);
main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

// Solution for https://atcoder.jp/contests/aising2020/tasks/aising2020_c

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

type contest struct {
	in  io.Reader
	out io.Writer
}

func (con *contest) Scan(a ...interface{}) (int, error) {
	return fmt.Fscan(con.in, a...)
}
func (con *contest) Scanln(a ...interface{}) (int, error) {
	return fmt.Fscanln(con.in, a...)
}
func (con *contest) Scanf(f string, a ...interface{}) (int, error) {
	return fmt.Fscanf(con.in, f, a...)
}
func (con *contest) Print(a ...interface{}) (int, error) {
	return fmt.Fprint(con.out, a...)
}
func (con *contest) Println(a ...interface{}) (int, error) {
	return fmt.Fprintln(con.out, a...)
}
func (con *contest) Printf(f string, a ...interface{}) (int, error) {
	return fmt.Fprintf(con.out, f, a...)
}
func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()
	con := &contest{in: in, out: out}
	con.main()
}

func (con *contest) main() error {
	var n int
	con.Scan(&n)
	a := make([]int, n+1)
	for x := 1; x <= n; x++ {
		p := x * x
		if p > n {
			break
		}
		for y := 1; y <= n; y++ {
			q := p + y*y + x*y
			if q > n {
				break
			}
			for z := 1; z <= n; z++ {
				r := q + z*z + y*z + z*x
				if r > n {
					break
				}
				a[r]++
			}
		}
	}
	for i := 1; i <= n; i++ {
		con.Println(a[i])
	}
	return nil
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)

	ans := make([]int, n+1)
	idx := 1
	for ; idx*idx <= n; idx++ {
		x := idx
		for y := 1; x*x+y*y <= n; y++ {
			for z := 1; x*x+y*y+z*z <= n; z++ {
				if v := x*x + y*y + z*z + x*y + y*z + z*x; v <= n {
					ans[v]++
				}
			}
		}
	}

	wr := bufio.NewWriter(os.Stdout)
	for _, v := range ans[1:] {
		wr.WriteString(strconv.Itoa(v) + "\n")
	}
	wr.Flush()
}


package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	f := make([]int, n+1)

	nf := func(x int, y int, z int) int {
		return x*x + y*y + z*z + x*y + y*z + z*x
	}

	xf := true
	for x := 1; xf; x++ {
		xf = false
		yf := true
		for y := 1; yf; y++ {
			nw := 0
			yf = false
			for z := 1; nw <= n; z++ {
				nw = nf(x, y, z)
				if nw <= n {
					xf = true
					yf = true
					f[nw]++
				}
			}
		}
	}
	for i := 1; i <= n; i++ {
		fmt.Fprintln(out, f[i])
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	//fmt.Fprintln(out, ans)

}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}


package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	a := make([]int, 10010)
	for x := 1; x <= 100; x++ {
		for y := 1; y <= 100; y++ {
			for z := 1; z <= 100; z++ {
				v := x*x + y*y + z*z + x*y + y*z + z*x
				if v <= 10000 {
					a[v]++
				}
			}
		}
	}
	for i := 0; i < N; i++ {
		fmt.Println(a[i])
	}
}


package main

import "fmt"

func f(n int) int {
	var ret int
	for x := 1; x <= 100; x++ {
		if x*x <= n {
			for y := 1; y <= 100; y++ {
				if x*x+y*y+x*y <= n {
					for z := 1; z <= 100; z++ {
						if x*x+y*y+z*z+x*y+y*z+z*x == n {
							ret++
						}
					}
				}
			}
		}
	}
	return ret
}

func main() {
	var N int
	fmt.Scan(&N)
	for i := 1; i <= N; i++ {
		fmt.Println(f(i))
		// fmt.Println(i, f(i))
	}
}


package main

import "fmt"

func f(n int) int {
	var ret int
	for x := 1; x <= 100; x++ {
		for y := 1; y <= 100; y++ {
			for z := 1; z <= 100; z++ {
				if n == x*x+y*y+z*z+x*y+y*z+z*x {
					ret++
				}
			}
		}
	}
	return ret
}

func main() {
	var N int
	fmt.Scan(&N)
	for i := 1; i <= N; i++ {
		fmt.Println(f(i))
		// fmt.Println(i, f(i))
	}
}


N = gets.to_i

F = lambda{|x,y,z| x*x+y*y+z*z+x*y+y*z+z*x }
Fn = [0]*(N+1)

x=y=z=1
until N < n=F[x,x,x]
	Fn[n] += 1
	z = x+1
	until N < n=F[x,x,z]
		Fn[n] += 3
		z += 1
	end
	y = x+1
	until N < n=F[x,y,y]
		Fn[n] += 3
		z = y+1
		until N < n=F[x,y,z]
			Fn[n] += 6
			z += 1
		end
		y += 1
	end
	x += 1
end

puts Fn.drop 1


n = gets.to_i
arr = Array.new(n + 1) { 0 }

1.upto(100) do |x|
  x.upto(100) do |y|
    y.upto(100) do |z|
      f = (x + y + z)**2 - x * y - y * z - z * x
      break if f > n

      if x == y && y == z
        arr[f] += 1
      else
        arr[f] += (x != y && y != z) ? 6 : 3
      end
    end
  end
end

puts arr.drop(1)


N = gets.to_i

ans = Array.new(N, 0)
1.step(100) do |x|
  x.step(100) do |y|
    y.step(100) do |z|
      n = x**2 + y**2 + z**2 + x*y + y*z + z*x
      break if N < n
      ans[n - 1] +=
        case
        when x == y && x == z then 1
        when x != y && y != z then 6
        else ;                   ; 3
        end
    end
  end
end

puts ans


n=gets.to_i

n.times.each do |k|
    k=k+1
    if k<6
        p 0
        next
    end
    v=[*1..k**0.3]
    array=v.repeated_permutation(3).to_a

    count=0
    for j in 0..array.length-1
        if array[j][0]**2+array[j][1]**2+array[j][2]**2+array[j][0]*array[j][1]+array[j][0]*array[j][2]+array[j][2]*array[j][1]==k
            count+=1
        end
    end

    p count
end


n=gets.to_i

n.times.each do |k|
    k=k+1
    if k<6
        p 0
        next
    end
    v=[*1..k**0.5]
    array=v.repeated_permutation(3).to_a

    count=0
    for j in 0..array.length-1
        if array[j][0]**2+array[j][1]**2+array[j][2]**2+array[j][0]*array[j][1]+array[j][0]*array[j][2]+array[j][2]*array[j][1]==k
            count+=1
        end
    end

    p count
end


num = gets.chomp.to_i
# num = 20
# 入力値を受けとる

(1..num).each do |n|

    result_count = 0

    pre_arr_x = (1..n).to_a
    pre_arr_y = (1..n).to_a
    pre_arr_z = (1..n).to_a

    total_arr = pre_arr_x.product(pre_arr_y, pre_arr_z)
    # 全ての組み合わせを一つの配列に格納してくれる

    total_arr.each do |a|
        x = a[0]
        y = a[1]
        z = a[2]

        if (x + y + z) ** 2 - (x * y + y * z + z * x) === n
            result_count += 1
        end

    end

    p result_count

end


#![allow(unused_imports, unused_macros)]

use kyoproio::*;
use std::{
    collections::*,
    io::{self, prelude::*},
    iter,
    mem::{replace, swap},
};

fn main() -> io::Result<()> {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024)
        .spawn(|| {
            let stdin = io::stdin();
            let stdout = io::stdout();
            run(KInput::new(stdin.lock()), io::BufWriter::new(stdout.lock()))
        })?
        .join()
        .unwrap();
    Ok(())
}

fn run<I: Input, O: Write>(mut kin: I, mut out: O) {
    macro_rules! output { ($($args:expr),+) => { write!(&mut out, $($args),+).unwrap(); }; }
    macro_rules! outputln {
        ($($args:expr),+) => { output!($($args),+); outputln!(); };
        () => { output!("\n"); if cfg!(debug_assertions) { out.flush().unwrap(); } }
    }

    let n: usize = kin.input();
    let mut ans = vec![0; n + 1];
    for x in 1.. {
        if x * x >= n {
            break;
        }
        for y in 1.. {
            if x * x + y * y >= n {
                break;
            }
            for z in 1.. {
                let a = x * x + y * y + z * z + x * y + y * z + z * x;
                if a > n {
                    break;
                }
                ans[a] += 1;
            }
        }
    }
    for i in 1..=n {
        outputln!("{}", ans[i]);
    }
}

// -----------------------------------------------------------------------------
pub mod kyoproio {
    use std::io::prelude::*;
    pub trait Input {
        fn str(&mut self) -> &str;
        fn input<T: InputParse>(&mut self) -> T {
            T::input(self)
        }
        fn iter<T: InputParse>(&mut self) -> Iter<T, Self> {
            Iter(self, std::marker::PhantomData)
        }
        fn seq<T: InputParse, B: std::iter::FromIterator<T>>(&mut self, n: usize) -> B {
            self.iter().take(n).collect()
        }
    }
    pub struct KInput<R> {
        src: R,
        buf: String,
        pos: usize,
    }
    impl<R: BufRead> KInput<R> {
        pub fn new(src: R) -> Self {
            Self {
                src,
                buf: String::with_capacity(1024),
                pos: 0,
            }
        }
    }
    impl<R: BufRead> Input for KInput<R> {
        fn str(&mut self) -> &str {
            loop {
                if self.pos >= self.buf.len() {
                    self.pos = 0;
                    self.buf.clear();
                    if self.src.read_line(&mut self.buf).expect("io error") == 0 {
                        return &self.buf;
                    }
                }
                let range = self.pos
                    ..self.buf[self.pos..]
                        .find(|c: char| c.is_ascii_whitespace())
                        .map(|i| i + self.pos)
                        .unwrap_or_else(|| self.buf.len());
                self.pos = range.end + 1;
                if range.end > range.start {
                    return &self.buf[range];
                }
            }
        }
    }
    pub struct Iter<'a, T, I: ?Sized>(&'a mut I, std::marker::PhantomData<*const T>);
    impl<'a, T: InputParse, I: Input + ?Sized> Iterator for Iter<'a, T, I> {
        type Item = T;
        fn next(&mut self) -> Option<T> {
            Some(self.0.input())
        }
    }
    pub trait InputParse: Sized {
        fn input<I: Input + ?Sized>(src: &mut I) -> Self;
    }
    impl InputParse for Vec<u8> {
        fn input<I: Input + ?Sized>(src: &mut I) -> Self {
            src.str().as_bytes().to_owned()
        }
    }
    macro_rules! from_str_impl {
        { $($T:ty)* } => {
            $(impl InputParse for $T {
                fn input<I: Input + ?Sized>(src: &mut I) -> Self {
                    src.str().parse::<$T>().expect("parse error")
                }
            })*
        }
    }
    from_str_impl! {
        String char bool f32 f64 isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128
    }
    macro_rules! tuple_impl {
        ($H:ident $($T:ident)*) => {
            impl<$H: InputParse, $($T: InputParse),*> InputParse for ($H, $($T),*) {
                fn input<I: Input + ?Sized>(src: &mut I) -> Self {
                    ($H::input(src), $($T::input(src)),*)
                }
            }
            tuple_impl!($($T)*);
        };
        () => {}
    }
    tuple_impl!(A B C D E F G);
    #[macro_export]
    macro_rules! kdbg {
        ($($v:expr),*) => {
            if cfg!(debug_assertions) { dbg!($($v),*) } else { ($($v),*) }
        }
    }
}


use proconio::*;

#[fastout]
fn main() {
    input! {
        n: usize,
    };
    let mut ans = [0; 10001];

    for x in 1..=100 {
        for y in x..=100 {
            for z in y..=100 {
                let t = x * x + y * y + z * z + x * y + y * z + x * z;
                if t <= n {
                    ans[t] += if x == y && y == z {
                        1
                    } else if x == y || y == z || x == z {
                        3
                    } else {
                        6
                    };
                }
            }
        }
    }

    for a in &ans[1..=n] {
        println!("{}", a);
    }
}


use proconio::{input,fastout};

fn f(x: usize, y: usize, z: usize) -> usize {
    x*x + y*y + z*z + x*y + y*z + z*x
}

#[fastout]
fn main() {
    input! {
        n: usize
    }
    let mut v = vec![0; n];
    for i in 1..n {
        if i*i > n { break; }
        for j in 1..n {
            if j*j > n { break; }
            for k in 1..n {
                if k*k > n { break; }
                let m = f(i,j,k);
                if m <= n { v[m-1] += 1; }
                else { break; }
            }
        }
    }
    for &x in &v { println!("{}", x) }
}


use proconio::{input, fastout};

fn main() {
  input!{
    n: i64
  }
  for i in 1..=n {
    let mut ans = 0;
      for x in 1..n {
          for y in x..n {
              for z in y..n {
                  if x*x + y*y + z*z + x*y + y*z + z*x == i {
                      if x == y && y == z && z == x {
                        ans += 1;
                      }else if x != y && y != z && z != x {
                        ans += 6;
                      }else{
                        ans += 3;
                      }
                  }
              }
          }
      }
    println!("{}",ans);
  }
}


use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {n: usize};

    let mut result: Vec<usize> = vec![0; n];
    let mut v: Vec<usize> = vec![0; 3];

    dfs(&mut v, &mut result, 0, n)
}

fn dfs(v: &mut Vec<usize>, result: &mut Vec<usize>, index: usize, n: usize) {
    if index == 3 {
        let sum = v[0] * v[0] + v[1] * v[1] + v[2] * v[2] + v[0] * v[1] + v[1] * v[2] + v[2] * v[0];

        // 20↓
        if sum <= n {
            // 1 -> 20
            for i in 1..n + 1 {
                if sum == i {
                    result[i - 1] += 1;
                    break;
                }
            }
        }
    } else {
        let x = (n as f64).sqrt() as usize + 1;
        for i in 1..x {
            v[index] = i;
            dfs(v, result, index + 1, n);
        }
    }
}


use proconio::*;

#[fastout]
fn main() {
    input! {
        n: usize,
    };

    let mut ans = vec![0; n + 1];

    for i in 1..n {
        for x in 1..100 {
            for y in 1..100 {
                for z in 1..100 {
                    let t = x * x + y * y + z * z + x * y + y * z + x * z;
                    if t == i {
                        ans[i] += 1;
                    }
                }
            }
        }
    }
    for a in &ans {
        println!("{}", a);
    }
}


func readInt() -> Int {
    return Int(readLine()!)!
}

func result(x: Int, y: Int, z: Int) -> Int {
    return x*x + y*y + z*z + z*y + x*y + x*z
}

func mainC() {
    let N = readInt()

    var score = (0...N).map { _ in return 0 }

    let max = 100
    for i in 1...max {
        for j in 1...max {
            for k in 1...max {
                let res = result(x: i, y: j, z: k)
                if res < score.count {
                    score[res] += 1
                }
            }
        }
    }

    for n in 1...N {
        print(score[n])
    }

}

mainC()


import Foundation
func C() {
    let N = Int(readLine()!)!
    let MAX = 100
    var memo = Array(repeating: 0, count: N+1)
    for x in 1...MAX{
        for y in 1...MAX{
            for z in 1...MAX{
                let a = pow(Double(x), 2.0) + pow(Double(y), 2.0) + pow(Double(z), 2.0)
                let b = x*y + y*z + z*x
                let c = Int(a) + b
                if c > N {
                    continue
                }
                memo[c] += 1
            }
        }
    }
    for i in 1...N{
        print(memo[i])
    }
}

C()


let n = Int(readLine()!)!
var list = Array(repeating: 0, count: n+1)
for x in 1...n {
    guard x*x <= n else { break }
    for y in 1...n {
        guard x*x+y*(x+y) <= n else { break }
        for z in 1...n {
            let i = x*x+y*(x+y)+z*(x+y+z)
            guard i <= n else { break }
            list[i] += 1
        }
    }
}
for i in 1...n {
    print(list[i])
}


import Foundation

let input_N = Int(readLine()!)!
var counts = [Int](repeating: 0, count: input_N)
// x+y ^2 + y+z ^2 + z+x ^2 = 2n
let min = Int(sqrt(Double(input_N) / 6.0))
let max = Int(sqrt(Double(input_N)))

for it in 1...input_N {
    // x >= y >= z
    for x in min...max {
        for z in 1...min {
            for y in z...x {
                if x*x + y*y + z*z + x*y + y*z + z*x == it {
                    if x == y && y == z {
                        counts[it-1] += 1
                    } else if x == y || y == z {
                        counts[it-1] += 3
                    } else {
                        counts[it-1] += 6
                    }
                }
            }
        }
    }
}

counts.forEach {print($0)}


import Foundation

let input_N = Int(readLine()!)!
var counts = [Int](repeating: 0, count: input_N)
let max = Int(sqrt(Double(input_N - 5)))

for it in 1...input_N {
    // x >= y >= z
    for x in 1...max {
        for y in 1...x {
            for z in 1...y {
                if x*x + y*y + z*z + x*y + y*z + z*x == it {
                    if x == y && y == z {
                        counts[it-1] += 1
                    } else if x == y || y == z {
                        counts[it-1] += 3
                    } else {
                        counts[it-1] += 6
                    }
                }
            }
        }
    }
}

counts.forEach {print($0)}


import Foundation

let input_N = Int(readLine()!)!
var counts = [Int](repeating: 0, count: input_N)
// x+y ^2 + y+z ^2 + z+x ^2 = 2n
let min = Int(sqrt(Double(input_N) / 6.0))
let max = Int(sqrt(Double(input_N - 5)))

for it in 6...input_N {
    // x >= y >= z
    for x in min...max {
        for y in 1...x {
            for z in 1...y {
                if x*x + y*y + z*z + x*y + y*z + z*x == it {
                    if x == y && y == z {
                        counts[it-1] += 1
                    } else if x == y || y == z {
                        counts[it-1] += 3
                    } else {
                        counts[it-1] += 6
                    }
                }
            }
        }
    }
}

counts.forEach {print($0)}


import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  const T: { [key: number]: number | undefined } = {};

  for (let x = 1; x * x <= N; x++) {
    for (let y = 1; y * y <= N; y++) {
      for (let z = 1; z * z <= N; z++) {
        const n = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x;

        T[n] = (T[n] || 0) + 1;
      }
    }
  }

  const F: number[] = [];

  for (let i = 1; i <= N; i++) {
    F.push(T[i] || 0);
  }

  return F.join("\n");
};

console.log(main(read()));


import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}

const judge = (number :number) => {
    const T: { [key: number]: number | undefined } = {};

    for (let x = 1; x * x <= number; x++) {
        for (let y = 1; y * y <= number; y++) {
            for (let z = 1; z * z <= number; z++) {
                const n:number = formula(x, y, z)
                T[n] = (T[n] || 0) + 1;
            }
        }
    }
    return T
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))
    const res:{[key: string]: number | undefined} = judge(data[0])
    const ans:number[] = []
    for (let i :number = 1; i <= data[0]; i++){
        ans.push(res[i] || 0)
    }
    return ans
}

console.log(...main())


import * as fs from "fs";

// inputで受け取り配列化する
const input = Number(fs.readFileSync("/dev/stdin", "utf8"));

let num = 1;
while (true) {
  const _num = Math.pow(num, 2) + 1 + 1 + 1 + num + num;
  if (_num > input) {
    break;
  }
  num++;
}

const map = new Map();

for (let x = 1; x <= num; x++) {
  for (let y = 1; y <= num; y++) {
    for (let z = 1; z <= num; z++) {
      const sum =
        Math.pow(x, 2) +
        Math.pow(y, 2) +
        Math.pow(z, 2) +
        x * y +
        y * z +
        x * z;
      if (map.has(sum)) {
        const cnt = map.get(sum);
        map.set(sum, cnt + 1);
      } else {
        map.set(sum, 1);
      }
    }
  }
}

for (let index = 1; index <= input; index++) {
  if (map.has(index)) {
    console.log(map.get(index));
  } else {
    console.log(0);
  }
}


import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}

const judge = (number :number) => {
    let ans:number[] =[]
    for (let i:number = 1; i <= number; i++){
        if (i < 6){
            ans.push(0)
            continue
        }
        let counter:number = 0
        let num: number = i/6
        for (let j:number = 1; j <= num; j++){
            if (formula(j, j, j) === i){
                counter ++
            }
            if (formula(j, j, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+2) === i){
                counter +=6
            }
            if (formula(j, j+2, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+3) === i){
                counter +=3
            }
            if (formula(j, j+3, j+3) === i){
                counter +=3
            }
            if (formula(j, j+2, j+3) === i){
                counter +=6
            }
            if (formula(j, j, j+3) === i){
                counter +=3
            }
        }
        ans.push(counter)
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))

    return judge(data[0])
}

console.log(...main())


import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}

const judge = (number :number) => {
    let ans:number[] =[]
    for (let i:number = 1; i <= number; i++){
        if (i < 6){
            ans.push(0)
            continue
        }
        let counter:number = 0
        let num: number = i/6
        for (let j:number = 1; j <= num; j++){
            if (formula(j, j, j) === i){
                counter ++
            }
            if (formula(j, j, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+2) === i){
                counter +=6
            }
            if (formula(j, j+2, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+2) === i){
                counter +=3
            }
        }
        ans.push(counter)
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))

    return judge(data[0])
}

console.log(...main())


import * as fs from "fs"

const formula = (x:number, y:number, z:number) => {
    return Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2) + x * y + y * z + z * x
}

const judge = (number :number) => {
    let ans:number[] =[]
    for (let i:number = 1; i <= number; i++){
        if (i < 6){
            ans.push(0)
            continue
        }
        let counter:number = 0
        let num: number = i/6
        for (let j:number = 1; j <= num; j++){
            if (formula(j, j, j) === i){
                counter ++
            }
            if (formula(j, j, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+1) === i){
                counter +=3
            }
            if (formula(j, j+1, j+2) === i){
                counter +=3
            }
            if (formula(j, j+2, j+2) === i){
                counter +=3
            }
            if (formula(j, j, j+2) === i){
                counter +=3
            }
        }
        ans.push(counter)
    }
    return ans
}

export const main = () => {
    const inp:string[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n')
    const data:number[] = inp[0].split(' ').map((val:string) => Number(val))

    return judge(data[0])
}

console.log(...main())


a = input()
m = ["01","02","03","04","05","06","07","08","09","10","11","12"]
if a[:2] in m and a[2:] in m:
  print("AMBIGUOUS")
elif a[:2] not in m and a[2:] in m:
  print("YYMM")
elif a[:2] in m and a[2:] not in m:
  print("MMYY")
else:
  print("NA")


S = input()

s = list(S)
num = []
for k in s:
    num.append(int(k))

num1 = 10*num[0] + num[1]

num2 = 10*num[2] + num[3]

ans1 = False
ans2 = False
if num1 < 13 and num1 >0:
    ans1 = True

if num2 < 13 and num2 >0:
    ans2 = True

if ans1 and ans2:
    print("AMBIGUOUS")
elif ans1 and not ans2:
    print("MMYY")
elif not ans1 and ans2:
    print("YYMM")
else:
    print("NA")


s = list(str(input()))
a = int(s[0]+s[1])
b = int(s[2]+s[3])
if 0 < a < 13:
    if 0 < b < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if 0 < b < 13:
        print("YYMM")
    else:
        print("NA")


inp = input()
fst = int(inp[0:2])
snd = int(inp[2:4])

if(fst!=0 and fst>0 and fst<=12 and snd!=0 and snd>0 and snd<=12):
    print("AMBIGUOUS")
else:
    if(fst!=0 and fst>0 and fst>=12 and snd>0 and snd!=0 and snd<=12):
        print("YYMM")
    elif(fst!=0 and fst>0 and snd>0 and fst<=12 and snd!=0 and snd>=12):
        print("MMYY")
    else:
        print("NA")


inp = input()
fst = int(inp[0:2])
snd = int(inp[2:4])

if(fst!=0 and fst<=12 and snd!=0 and snd<=12):
    print("AMBIGUOUS")
else:
    if(fst!=0 and fst>=12 and snd!=0 and snd<=12):
        print("YYMM")
    elif(fst!=0 and fst<=12 and snd!=0 and snd>=12):
        print("MMYY")
    else:
        print("NA")


s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
if (0<s1<13)and(0<s2<13):
    print("AMBIGUOUS")
elif (0<s1<13)and(s2!=0):
    print("MMYY")
elif (s1!=0)and(0<s2<13):
    print("YYMM")
else:
    print("NA")


import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.IntStream;

public class Main {
	public static void main(String[] args) {
		Main main = new Main();
		main.solve();
	}

	private void solve() {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		String left = S.substring(0, 2);
		String right = S.substring(2, 4);
		Integer leftInt = Integer.parseInt(left);
		Integer rightInt = Integer.parseInt(right);
		if (isMM(leftInt)) {
			if (isMM(rightInt)) {
				System.out.println("AMBIGUOUS");
			} else {
				System.out.println("MMYY");
			}
		} else {
			if (isMM(rightInt)) {
				System.out.println("YYMM");
			} else {
				System.out.println("NA");
			}
		}
	}

	private boolean isMM(Integer i) {
		if (i == 0) {
			return false;
		}
		if (i > 12) {
			return false;
		}
		return true;
	}

	class Scanner {
		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int index;
		private int length;

		public Scanner(InputStream in) {
			this.in = in;
		}

		private boolean isPrintableChar(int c) {
			return '!' <= c && c <= '~';
		}

		private boolean isDigit(int c) {
			return '0' <= c && c <= '9';
		}

		private boolean hasNextByte() {
			if (index < length) {
				return true;
			} else {
				try {
					length = in.read(buffer);
					index = 0;
				} catch (IOException e) {
					e.printStackTrace();
				}
				return length > 0;
			}
		}

		private boolean hasNext() {
			while (hasNextByte() && !isPrintableChar(buffer[index])) {
				index++;
			}
			return hasNextByte();
		}

		private int readByte() {
			return hasNextByte() ? buffer[index++] : -1;
		}

		public String next() {
			if (!hasNext()) {
				throw new RuntimeException("no input");
			}
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (isPrintableChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public long nextLong() {
			if (!hasNext()) {
				throw new RuntimeException("no input");
			}
			long value = 0L;
			boolean minus = false;
			int b = readByte();
			if (b == '-') {
				minus = true;
				b = readByte();
			}
			while (isPrintableChar(b)) {
				if (isDigit(b)) {
					value = value * 10 + (b - '0');
				}
				b = readByte();
			}
			return minus ? -value : value;
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	interface CombCalculator {
		long comb(int n, int m);
	}

	interface MobiusFunction {
		int get(int n);
	}

	/**
	 * メビウス関数をエラトステネスの篩っぽく前計算するクラスです。
	 * 計算量はO(1)で、前計算でO(N logN)です。
	 */
	class SieveMobiusFunction implements MobiusFunction {
		int size;
		int[] mobiusFunctionValues;

		public SieveMobiusFunction(int size) {
			this.size = size;
			mobiusFunctionValues = new int[size];

			mobiusFunctionValues[0] = 0;
			mobiusFunctionValues[1] = 1;
			for (int i = 2; i < size; i++) {
				mobiusFunctionValues[i] = 1;
			}
			for (int i = 2; i * i < size; i++) {
				for (int k = 1; i * i * k < size; k++) {
					mobiusFunctionValues[i * i * k] *= 0;
				}
			}

			for (int i = 2; i < size; i++) {
				if (mobiusFunctionValues[i] == 1) {
					for (int k = 1; i * k < size; k++) {
						mobiusFunctionValues[i * k] *= -2;
					}
				}
				if (mobiusFunctionValues[i] > 1) {
					mobiusFunctionValues[i] = 1;
				}
				if (mobiusFunctionValues[i] < -1) {
					mobiusFunctionValues[i] = -1;
				}
			}
		}

		@Override
		public int get(int n) {
			if (n > size) {
				throw new RuntimeException("n is greater than size.");
			}
			if (n < 0) {
				return 0;
			}
			return mobiusFunctionValues[n];
		}
	}

	/**
	 * メビウス関数を定義通り計算するクラスです。
	 * 計算量はO(logN)です。
	 */
	class PrimeFactorizationMobiusFunction implements MobiusFunction {
		@Override
		public int get(int n) {
			if (n <= 0) {
				return 0;
			}
			if (n == 1) {
				return 1;
			}
			int num = 0;
			for (int i = 2; i < n; i++) {
				if (n % i == 0) {
					n /= i;
					num++;
					if (n % i == 0) {
						return 0;
					}
				}
			}
			return num % 2 == 0 ? -1 : 1;
		}
	}

	/**
	 * 組み合わせ計算を階乗の値で行うクラスです(MOD対応)
	 * 階乗とその逆元は前計算してテーブルに格納します。
	 * C(N, N) % M の計算量は O(1)、 前計算でO(max(N, logM))です。
	 * sizeを1e8より大きい値で実行するとMLEの危険性があります。
	 * また素数以外のMODには対応していません(逆元の計算に素数の剰余環の性質を利用しているため)。
	 */
	class FactorialTableCombCalculator implements CombCalculator {
		int size;
		long[] factorialTable;
		long[] inverseFactorialTable;
		long mod;

		public FactorialTableCombCalculator(int size, long mod) {
			this.size = size;
			factorialTable = new long[size + 1];
			inverseFactorialTable = new long[size + 1];
			this.mod = mod;

			factorialTable[0] = 1L;
			for (int i = 1; i <= size; i++) {
				factorialTable[i] = (factorialTable[i - 1] * i) % mod;
			}
			inverseFactorialTable[size] = inverse(factorialTable[size], mod);
			for (int i = size - 1; i >= 0; i--) {
				inverseFactorialTable[i] = (inverseFactorialTable[i + 1] * (i + 1)) % mod;
			}
		}

		private long inverse(long n, long mod) {
			return pow(n, mod - 2, mod);
		}

		private long pow(long n, long p, long mod) {
			if (p == 0) {
				return 1L;
			}
			long half = pow(n, p / 2, mod);
			long ret = (half * half) % mod;
			if (p % 2 == 1) {
				ret = (ret * n) % mod;
			}
			return ret;
		}

		@Override
		public long comb(int n, int m) {
			if (n > size) {
				throw new RuntimeException("n is greater than size.");
			}
			if (n < 0 || m < 0 || n < m) {
				return 0L;
			}
			return (((factorialTable[n] * inverseFactorialTable[m]) % mod) * inverseFactorialTable[n - m]) % mod;
		}
	}

	/**
	 * 組み合わせ計算をテーブルで実装したクラスです(MOD対応)
	 * 前計算でO(N^2), combはO(1)で実行できます
	 * sizeを2 * 1e4より大きい値で実行するとMLEの危険性があります
	 */
	class TableCombCalculator implements CombCalculator {
		long[][] table;
		int size;

		public TableCombCalculator(int size, long mod) {
			this.size = size;
			table = new long[size + 1][];

			table[0] = new long[1];
			table[0][0] = 1L;
			for (int n = 1; n <= size; n++) {
				table[n] = new long[n + 1];
				table[n][0] = 1L;
				for (int m = 1; m < n; m++) {
					table[n][m] = (table[n - 1][m - 1] + table[n - 1][m]) % mod;
				}
				table[n][n] = 1L;
			}
		}

		@Override
		public long comb(int n, int m) {
			if (n > size) {
				throw new RuntimeException("n is greater than size.");
			}
			if (n < 0 || m < 0 || n < m) {
				return 0L;
			}
			return table[n][m];
		}
	}

	interface Graph {
		void link(int from, int to, long cost);
		Optional<Long> getCost(int from, int to);
		int getVertexNum();
	}

	interface FlowResolver {
		long maxFlow(int from, int to);
	}

	/**
	 * グラフの行列による実装
	 * 接点数の大きいグラフで使うとMLEで死にそう
	 */
	class ArrayGraph implements Graph {
		private Long[][] costArray;
		private int vertexNum;

		public ArrayGraph(int n) {
			costArray = new Long[n][];
			for (int i = 0; i < n; i++) {
				costArray[i] = new Long[n];
			}
			vertexNum = n;
		}

		@Override
		public void link(int from, int to, long cost) {
			costArray[from][to] = new Long(cost);
		}

		@Override
		public Optional<Long> getCost(int from, int to) {
			return Optional.ofNullable(costArray[from][to]);
		}

		@Override
		public int getVertexNum() {
			return vertexNum;
		}
	}

	/**
	 * DFS(深さ優先探索)による実装
	 * 計算量はO(E*MaxFlow)のはず (E:辺の数, MaxFlow:最大フロー)
	 */
	class DfsFlowResolver implements FlowResolver {
		private Graph graph;
		public DfsFlowResolver(Graph graph) {
			this.graph = graph;
		}

		/**
		 * 最大フロー(最小カット)を求める
		 * @param from 始点(source)のID
		 * @param to 終点(target)のID
		 * @return 最大フロー(最小カット)
		 */
		public long maxFlow(int from, int to) {
			long sum = 0L;
			long currentFlow;
			do {
				currentFlow = flow(from, to, Long.MAX_VALUE / 3, new boolean[graph.getVertexNum()]);
				sum += currentFlow;
			} while (currentFlow > 0);
			return sum;
		}

		/**
		 * フローの実行 グラフの更新も行う
		 * @param from 現在いる節点のID
		 * @param to 終点(target)のID
		 * @param current_flow ここまでの流量
		 * @param passed 既に通った節点か否かを格納した配列
		 * @return 終点(target)に流した流量/戻りのグラフの流量
		 */
		private long flow(int from, int to, long current_flow, boolean[] passed) {
			passed[from] = true;
			if (from == to) {
				return current_flow;
			}
			for (int id = 0; id < graph.getVertexNum(); id++) {
				if (passed[id]) {
					continue;
				}
				Optional<Long> cost = graph.getCost(from, id);
				if (cost.orElse(0L) > 0) {
					long nextFlow = current_flow < cost.get() ? current_flow : cost.get();
					long returnFlow = flow(id, to, nextFlow, passed);
					if (returnFlow > 0) {
						graph.link(from, id, cost.get() - returnFlow);
						graph.link(id, from, graph.getCost(id, from).orElse(0L) + returnFlow);
						return returnFlow;
					}
				}
			}
			return 0L;
		}
	}

	/**
	 * 1-indexedのBIT配列
	 */
	class BinaryIndexedTree {
		private long[] array;

		public BinaryIndexedTree(int size) {
			this.array = new long[size + 1];
		}

		/**
		 * 指定した要素に値を加算する
		 * 計算量はO(logN)
		 * @param index 加算する要素の添字
		 * @param value 加算する量
		 */
		public void add(int index, long value) {
			for (int i = index; i < array.length; i += (i & -i)) {
				array[i] += value;
			}
		}

		/**
		 * 1〜指定した要素までの和を取得する
		 * 計算量はO(logN)
		 * @param index 和の終端となる要素の添字
		 * @return 1〜indexまでの和
		 */
		public long getSum(int index) {
			long sum = 0L;
			for (int i = index; i > 0; i -= (i & -i)) {
				sum += array[i];
			}
			return sum;
		}
	}

	/**
	 * 1-indexedの2次元BIT配列
	 */
	class BinaryIndexedTree2D {
		private long[][] array;

		public BinaryIndexedTree2D(int size1, int size2) {
			this.array = new long[size1 + 1][];
			for (int i = 1; i <= size1; i++) {
				this.array[i] = new long[size2 + 1];
			}
		}

		/**
		 * 指定した要素に値を加算する
		 * 計算量はO(logN * logN)
		 * @param index1 加算する要素の1次元目の添字
		 * @param index2 加算する要素の2次元目の添字
		 * @param value 加算する量
		 */
		public void add(int index1, int index2, long value) {
			for (int i1 = index1; i1 < array.length; i1 += (i1 & -i1)) {
				for (int i2 = index2; i2 < array.length; i2 += (i2 & -i2)) {
					array[i1][i2] += value;
				}
			}
		}

		/**
		 * (1,1)〜指定した要素までの矩形和を取得する
		 * 計算量はO(logN * logN)
		 * @param index1 和の終端となる要素の1次元目の添字
		 * @param index2 和の終端となる要素の2次元目の添字
		 * @return (1,1)〜(index1,index2)までの矩形和
		 */
		public long getSum(int index1, int index2) {
			long sum = 0L;
			for (int i1 = index1; i1 > 0; i1 -= (i1 & -i1)) {
				for (int i2 = index2; i2 > 0; i2 -= (i2 & -i2)) {
					sum += array[i1][i2];
				}
			}
			return sum;
		}
	}

	interface UnionFind {
		void union(int A, int B);
		boolean judge(int A, int B);
		Set<Integer> getSet(int id);
	}

	/**
	 * ArrayUnionFindの拡張
	 * MapSetで根の添字から根にぶら下がる頂点の集合が取得できるようにした
	 * getSetメソッドをO(logN * logN)に落とせているはず
	 * ただしunionメソッドは2倍の計算量になっているので注意(オーダーは変わらないはず)
	 */
	class SetUnionFind extends ArrayUnionFind {
		Map<Integer, Set<Integer>> map;
		public SetUnionFind(int size) {
			super(size);
			map = new HashMap<>();
			for (int i = 0; i < size; i++) {
				map.put(i, new HashSet<>());
				map.get(i).add(i);
			}
		}

		@Override
		protected void unionTo(int source, int dest) {
			super.unionTo(source, dest);
			map.get(dest).addAll(map.get(source));
		}

		@Override
		public Set<Integer> getSet(int id) {
			return map.get(root(id));
		}
	}

	/**
	 * 配列によるUnionFindの実装
	 * getSetメソッドはO(NlogN)なのでTLEに注意
	 */
	class ArrayUnionFind implements UnionFind {
		int[] parent;
		int[] rank;
		int size;
		public ArrayUnionFind(int size) {
			parent = new int[size];
			for (int i = 0; i < size; i++) {
				parent[i] = i;
			}
			rank = new int[size];
			this.size = size;
		}

		@Override
		public void union(int A, int B) {
			int rootA = root(A);
			int rootB = root(B);
			if (rootA != rootB) {
				if (rank[rootA] < rank[rootB]) {
					unionTo(rootA, rootB);
				} else {
					unionTo(rootB, rootA);
					if (rank[rootA] == rank[rootB]) {
						rank[rootA]++;
					}
				}
			}
		}

		protected void unionTo(int source, int dest) {
			parent[source] = dest;
		}

		@Override
		public boolean judge(int A, int B) {
			return root(A) == root(B);
		}

		@Override
		public Set<Integer> getSet(int id) {
			Set<Integer> set = new HashSet<>();
			IntStream.range(0, size).filter(i -> judge(i, id)).forEach(set::add);
			return set;
		}

		protected int root(int id) {
			if (parent[id] == id) {
				return id;
			}
			parent[id] = root(parent[id]);
			return parent[id];
		}
	}

	/**
	 * 素数のユーティリティ
	 */
	class PrimeNumberUtils {
		boolean[] isPrimeArray;
		List<Integer> primes;

		/**
		 * 素数判定の上限となる値を指定してユーティリティを初期化
		 * @param limit 素数判定の上限(この値以上が素数であるか判定しない)
		 */
		public PrimeNumberUtils(int limit) {
			if (limit > 10000000) {
				System.err.println("上限の値が高すぎるため素数ユーティリティの初期化でTLEする可能性が大変高いです");
			}
			primes = new ArrayList<>();
			isPrimeArray = new boolean[limit];
			if (limit > 2) {
				primes.add(2);
				isPrimeArray[2] = true;
			}

			for (int i = 3; i < limit; i += 2) {
				if (isPrime(i, primes)) {
					primes.add(i);
					isPrimeArray[i] = true;
				}
			}
		}

		public List<Integer> getPrimeNumberList() {
			return primes;
		}

		public boolean isPrime(int n) {
			return isPrimeArray[n];
		}

		private boolean isPrime(int n, List<Integer> primes) {
			for (int prime : primes) {
				if (n % prime == 0) {
					return false;
				}
				if (prime > Math.sqrt(n)) {
					break;
				}
			}
			return true;
		}
	}

	interface BitSet {
		void set(int index, boolean bit);
		boolean get(int index);
		void shiftRight(int num);
		void shiftLeft(int num);
		void or(BitSet bitset);
		void and(BitSet bitset);
	}

	/**
	 * Longの配列によるBitSetの実装
	 * get/setはO(1)
	 * shift/or/andはO(size / 64)
	 */
	class LongBit implements BitSet {
		long[] bitArray;

		public LongBit(int size) {
			bitArray = new long[((size + 63) / 64)];
		}

		@Override
		public void set(int index, boolean bit) {
			int segment = index / 64;
			int inIndex = index % 64;
			if (bit) {
				bitArray[segment] |= 1L << inIndex;
			} else {
				bitArray[segment] &= ~(1L << inIndex);
			}
		}

		@Override
		public boolean get(int index) {
			int segment = index / 64;
			int inIndex = index % 64;
			return (bitArray[segment] & (1L << inIndex)) != 0L;
		}

		@Override
		public void shiftRight(int num) {
			int shiftSeg = num / 64;
			int shiftInI = num % 64;
			for (int segment = 0; segment < bitArray.length; segment++) {
				int sourceSeg = segment + shiftSeg;
				if (sourceSeg < bitArray.length) {
					bitArray[segment] = bitArray[sourceSeg] >>> shiftInI;
					if (shiftInI > 0 && sourceSeg + 1 < bitArray.length) {
						bitArray[segment] |= bitArray[sourceSeg + 1] << (64 - shiftInI);
					}
				} else {
					bitArray[segment] = 0L;
				}
			}
		}

		@Override
		public void shiftLeft(int num) {
			int shiftSeg = num / 64;
			int shiftInI = num % 64;
			for (int segment = bitArray.length - 1; segment >= 0; segment--) {
				int sourceSeg = segment - shiftSeg;
				if (sourceSeg >= 0) {
					bitArray[segment] = bitArray[sourceSeg] << shiftInI;
					if (shiftInI > 0 && sourceSeg > 0) {
						bitArray[segment] |= bitArray[sourceSeg - 1] >>> (64 - shiftInI);
					}
				} else {
					bitArray[segment] = 0L;
				}
			}
		}

		public long getLong(int segment) {
			return bitArray[segment];
		}

		@Override
		public void or(BitSet bitset) {
			if (!(bitset instanceof LongBit)) {
				return;
			}
			for (int segment = 0; segment < bitArray.length; segment++) {
				bitArray[segment] |= ((LongBit)bitset).getLong(segment);
			}
		}

		@Override
		public void and(BitSet bitset) {
			if (!(bitset instanceof LongBit)) {
				return;
			}
			for (int segment = 0; segment < bitArray.length; segment++) {
				bitArray[segment] &= ((LongBit)bitset).getLong(segment);
			}
		}
	}

}


import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax
    static final int INF = 1_000_000_000; // 10^9
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		String s = saori.nextHayami();
		int num1 = Integer.parseInt(s.substring(0, 2));
		int num2 = Integer.parseInt(s.substring(2, 4));
		saori.close();
		if(0 <= num1 && num1 <= 99 && 1 <= num2 && num2 <= 12 && 0 <= num2 && num2 <= 99 && 1 <= num1 && num1 <= 12){
			System.out.println("AMBIGUOUS");
		} else if(0 <= num1 && num1 <= 99 && 1 <= num2 && num2 <= 12){
			System.out.println("YYMM");
		} else if(0 <= num2 && num2 <= 99 && 1 <= num1 && num1 <= 12){
			System.out.println("MMYY");
		} else {
			System.out.println("NA");
		}
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() {
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) {
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() {
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }

}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

/** テンプレート */
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String s = sc.next();

		int sint = new Integer(s).intValue();
		int up = sint / 100;
		int down = sint % 100;

		boolean UPMM = false;
		if(1 <= up && up <=12) {
			UPMM = true;
		}

		boolean DWMM = false;
		if(1 <= down && down <=12) {
			DWMM = true;
		}

//
//		Pair[] a = { new Pair(0, 5), new Pair(1, 10), new Pair(2, 3) };
//		Arrays.sort(a, new Comparator<Pair>() {
//			public int compare(Pair o1, Pair o2) {
//				return Integer.compare(o1.v, o2.v); //Java7以降
//			}
//		});

		//************************************/
		// ここから出力処理
		//************************************/
		PrintWriter out = new PrintWriter(System.out);
		if(UPMM && DWMM) {
			out.println("AMBIGUOUS");
		}else if(UPMM && !DWMM) {
			out.println("MMYY");
		}else if(!UPMM && DWMM) {
			out.println("YYMM");
		}else {
			out.println("NA");
		}

		// 最後に必ずFlush
		out.flush();
	}
}

///** テンプレート */
//public class Main {
//	public static void main(String[] args) {
//		FastScanner sc = new FastScanner();
//		int N = sc.nextInt();
//		int K = sc.nextInt();
//		String S = sc.next();
//
//		PrintWriter out = new PrintWriter(System.out);
//
//		for (int i = 0; i < N; i++) {
//			char c = S.charAt(i);
//			if(i != K-1) {
//				out.print(c);
//			}else {
//				out.print(Character.toLowerCase(c));
//			}
//		}
//
//
//
////
////		Pair[] a = { new Pair(0, 5), new Pair(1, 10), new Pair(2, 3) };
////		Arrays.sort(a, new Comparator<Pair>() {
////			public int compare(Pair o1, Pair o2) {
////				return Integer.compare(o1.v, o2.v); //Java7以降
////			}
////		});
//
//		//************************************/
//		// ここから出力処理
//		//************************************/
//	//	PrintWriter out = new PrintWriter(System.out);
//
//
//		// 最後に必ずFlush
//		out.flush();
//	}
//}

///** テンプレート */
//public class Main {
//	public static void main(String[] args) {
//		FastScanner sc = new FastScanner();
//		int N = sc.nextInt();
//		int M = sc.nextInt();
//
//		int[] ary = new int[N];
//		for (int i = 0; i < N; i++) {
//			ary[i] = sc.nextInt();
//		}
////
////		Pair[] a = { new Pair(0, 5), new Pair(1, 10), new Pair(2, 3) };
////		Arrays.sort(a, new Comparator<Pair>() {
////			public int compare(Pair o1, Pair o2) {
////				return Integer.compare(o1.v, o2.v); //Java7以降
////			}
////		});
//
//		//************************************/
//		// ここから出力処理
//		//************************************/
//		PrintWriter out = new PrintWriter(System.out);
//
//		out.println("hoge");
//
//		// 最後に必ずFlush
//		out.flush();
//	}
//}

/** スキャン用 */
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	/** クラス内部用だよ */
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	/** クラス内部用だよ */
	private int readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	/**
	 * クラス内部用だよ
	 * ASCII の文字の内、表示用の文字を返す関数
	 *
	 * @return 改行とか制御文字じゃない、表示用文字ならtrue
	 * */
	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	/**
	 * @return 改行文字とか空白以外を除いた、次の文字があればtrue
	 * */
	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}

	/**
	 *
	 * @return 次の文字列
	 */
	public String next() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}

		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	/**
	 *
	 * @return 次のLong
	 */
	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	/**
	 *
	 * @return 次のInt
	 */
	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	/**
	 *
	 * @return 次のDouble
	 */
	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

class Pair {
	int k;
	int v;

	public Pair(int k, int v) {
		this.k = k;
		this.v = v;
	}
}

//class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {
//	/** serialVersionUID. */
//	private static final long serialVersionUID = 6411527075103472113L;
//
//	public Pair(final K key, final V value) {
//		super(key, value);
//	}
//}


import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		int x = Integer.parseInt(S.substring(0, 2));
		int y = Integer.parseInt(S.substring(2, 4));

		int xFlg = 0;
		int yFlg = 0;

		if (1 <= x && x <= 12) {
			xFlg = 1;
		} else if (y != 0) {
			xFlg = 2;
		}

		if (1 <= y && y <= 12) {
			yFlg = 1;
		} else if (y != 0) {
			yFlg = 2;
		}

		if (xFlg == 0 || yFlg == 0 || (xFlg == 2 && yFlg == 2)) {
			System.out.println("NA");
		} else if (xFlg == 1 && yFlg == 1) {
			System.out.println("AMBIGUOUS");
		} else if (xFlg == 1) {
			System.out.println("MMYY");
		} else {
			System.out.println("YYMM");
		}
	}
}


import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		sc.close();

		int x = Integer.parseInt(S.substring(0, 2));
		int y = Integer.parseInt(S.substring(2, 4));

		int xFlg = 0;
		int yFlg = 0;

		if (1 <= x && x <= 12) {
			xFlg = 1;
		} else if (1 <= x && x <= 99) {
			xFlg = 2;
		}

		if (1 <= y && y <= 12) {
			yFlg = 1;
		} else if (1 <= y && y <= 99) {
			yFlg = 2;
		}

		if (xFlg == 0 || yFlg == 0) {
			System.out.println("NA");
		} else if (xFlg == 1 && yFlg == 1) {
			System.out.println("AMBIGUOUS");
		} else if (xFlg == 1) {
			System.out.println("MMYY");
		} else {
			System.out.println("YYMM");
		}
	}
}