C++#include<bits/stdc++.h>
namespace whaleL{
using namespace std;
#define pii pair<int, int>
#define fi first
#define se second
#define ull unsigned long long
#define ll long long
#define db double
#define re return
#define con continue
#define brk break
#define emp emplace
#define emb emplace_back
#define mpr make_pair
#define lwb lower_bound
#define upb upper_bound
#define all(x) x.begin(), x.end()
#define mms(a, b) memset(a, b, sizeof(a))
#define sml(a,b)(a=min(a,b))
#define big(a,b)(a=max(a,b))
#define fo(i,j,n)for(int i=(j);i<=(n);i++)
#define fr(i,j,n)for(int i=(j);i>=(n);i--)
#define fu(i,j,n)for(int i=(j);i<(n);i++)
#define f(i,n)fo(i,1,n)
#define r(i,n)fr(i,n,1)
#define u(i,n)fu(i,0,n)
#ifdef _WIN32
#define getchar _getchar_nolock
#define putchar _putchar_nolock
#elif __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define isd(c)((c)>47&&(c)<58)
#define iss(c)((c)<33)
#define il inline
#define tln template<typename m>
#define tls template<typename m,typename...ms>
#define getc(c) for(c=getchar();iss(c);c=getchar());
il void sf(){}il void ot(){}il void ut(){putchar('\n');}
tln il void sf(m&x){char f=1,c=getchar();x=0;for(;!isd(c);c=getchar())(c=='-')?f=-1:0;for(;isd(c);c=getchar())x=x*10+c-48;x*=f;}
tln il void ot(m x){x<0?x=-x,putchar('-'):0;static short s[51],t(0);do s[++t]=x%10;while(x/=10);for(;t;)putchar(s[t--]|48);}
il void sf(char&x){getc(x);}
il void ot(char x){putchar(x);}
il void sf(char*x){char c;getc(c);for(;!iss(c);c=getchar())*x++=c;*x=0;}
tln il void ot(m*x){while(*x)putchar(*x++);}
il void sf(string&x){x.clear();char c;getc(c);for(;!iss(c);c=getchar())x=x+c;}
il void ot(string x){printf("%s", x.c_str());}
il void sf(db&x){scanf("%lf", &x);}
il void ot(db x){printf("%lf", x);}
il void sf(long db&x){scanf("%Lf", &x);}
il void ot(long db x){printf("%Lf", x);}
tls il void sf(m&x,ms&...y){sf(x);sf(y...);}
tls il void ot(m x,ms...y){ot(x);ot(y...);}
tls il void ut(m x,ms...y){ot(x);putchar(' ');ut(y...);}
tln il void PC(m*a, m*b){for(;a!=b;cout<<*a++<<' ');ut();}
#ifndef ONLINE_JUDGE
#define err()cout<<"err "<<__LINE__,exit(0)
#define p(x...)(cout<<setw(18)<<#x,ot(" Line ",__LINE__," : "),ut(x))
#define pa(a, x...)(cout<<setw(18)<<#a,ot(" Line ",__LINE__," : "),ut(x))
#define po(x,y)(cout<<setw(18)<<#x,ot(" Line ",__LINE__," : "),PC(x,y))
#define g(x...) do{x;}while(0);
#else
#define err()1
#define p(x...)1
#define pa(x...)1
#define po(x...)1
#define g(x)
#endif
#ifndef DISFILE
#define file(x) freopen(#x ".in", "r", stdin), freopen(#x ".out", "w", stdout)
#else
#define file(x)
#endif
const ull MOD = 1e9 + 7;
#define mo(x)((1ULL*x)%MOD)
#define ma(x,y)(x=mo(y+(x)))
};using namespace whaleL;
const int N = 2e7 + 233;
int n, an;
char s[N], a[N];
il char tra(int u) {
if (u < 10) {
re u + '0';
}
u -= 10;
re u + 'A';
}
signed main() {
sf(n);
sf(s + 1);
int op = 0, res = 0;
r(i, n) {
res = res + (s[i] - '0') * (1 << op);
op ++;
if (op == 4)
a[++ an] = tra(res), op = 0;
}
if (op) a[++ an] = tra(res);
r(i, an) ot(a[i]);
}