#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>

int main(void) {
    char buf[256];

    // Read a full line
    if (!fgets(buf, sizeof(buf), stdin)) {
        printf("Invalid Input\n");
        return 0;
    }

    // Trim leading/trailing spaces
    char *p = buf;
    while (isspace((unsigned char)*p)) p++;
    char *endline = p + strlen(p);
    while (endline > p && isspace((unsigned char)endline[-1])) endline--;
    *endline = '\0';

    if (*p == '\0') {
        printf("Invalid Input\n");
        return 0;
    }

    // Strict integer parse with full consumption
    errno = 0;
    char *endptr = NULL;
    long long n = strtoll(p, &endptr, 10);

    if (errno == ERANGE) {
        printf("Invalid Input\n");
        return 0;
    }
    // Skip trailing spaces after the number
    while (*endptr && isspace((unsigned char)*endptr)) endptr++;
    if (*endptr != '\0') {
        printf("Invalid Input\n");
        return 0;
    }

    if (n < 0) {
        printf("-1\n");
        return 0;
    }
    if (n == 0) {
        printf("Invalid Input\n");
        return 0;
    }

    // Convert to Excel-style column label
    char label[64];
    int i = 0;
    while (n > 0) {
        n--; // A=1 adjustment
        int rem = (int)(n % 26);
        label[i++] = (char)('A' + rem);
        n /= 26;
    }
    // Reverse
    for (int j = 0; j < i / 2; j++) {
        char t = label[j];
        label[j] = label[i - j - 1];
        label[i - j - 1] =