#include<cstdio>
#include<cstring>
#include<iostream>
using namespace std;
int n,m,i,o;
char f[50];
int main()
{
freopen("wheel.in","r",stdin);
freopen("wheel.out","w",stdout);
while (scanf("%d%d\n",&n,&m)!=EOF){
char ch;
int x;
bool flag=true;
memset(f,0,sizeof(f));
int o=0;
for (i=1;i<=m;i++){
scanf("%d %c\n",&x,&ch);
x=x%n;
o+=x;
o%=n;
if (f[o]==0){
f[o]=ch;
}else if (f[o]!=ch && flag){
printf("!\n");
flag=false;
}
}
if (flag){
for (i=o;i>=0;i--)
{
if (f[i]!=0)
printf("%c",f[i]);else printf("?");
}
for (i=n-1;i>o;i--)
{
if (f[i]!=0)
printf("%c",f[i]);else printf("?");
}
printf("\n");
}
}
return 0;
}