#include<bits/stdc++.h>
using namespace std;
int N,m,ch[105],t,flag=0;
char chi[105],s[105];
int main(){
freopen("wheel.in","r",stdin);
freopen("wheel.out","w",stdout);
while(cin>>N>>m){
for (int i=1;i<=m;i++){
cin>>ch[i]>>chi[i];
}
for (int i=1;i<=100;i++) s[i]=0;
t=1,flag=0;
for (int i=m;i>=1;i--){
if (s[t]&&s[t]!=chi[i]){
cout<<"!"<<endl;
flag=1;
break;
}
s[t]=chi[i];
t+=ch[i];
if (t!=N) t=t%N;
}
if (flag==0){
for (int i=1;i<=N;i++){
if (s[i]) cout<<s[i];
else cout<<"?";
}
cout<<endl;
}
}
return 0;
}