#include<iostream>
using namespace std;
string convert(long long n){
    string s="";
    while(n>0){
        n--;
        s=char('A'+n%26)+s;
        n/=26;
    }
    return 0;
}
int main(){
    int key;
    cin>>key;
    if(key==1){
        long long n;
        if(!(cin>>n)||n<1){
            cout<<"Invalid input";
        }else{
            cout<<convert(n);
        }
    }
    else if(key==2){
        double n;
        if(!(cin>>n)||n<1.0){
            cout<<"Invalid input";
        }else{
            cout<<convert((long,long)n);
        }
    }
    else{
        cout<<"Invalid input";
    }
    return 0;
}