while(n,m=gets.split.map &:to_i)[0]>0
s=?#*n+?Z
m.times{(c=gets[0])<?B?(i=s.index ?#):c<?C?(i=n-1
i-=1 while i>=0&&(s[i]>?#||s[j=i+1]==?A||s[i-1]==?A)
i<0&&i=j-1):c<?D?(j=0
j+=1 while j<n&&(s[j]<?A||s[i=j+1]>?#&&s[i=j-1]>?#)
j>=n&&i=n/2):(w=z=1e20
t=[]
u=[]
(0..n-1).map{|k|s[k]>?#&&w=0;t<<w+=1;s[n-1-k]>?#&&z=0;u.unshift z+=1}
v=t.zip(u).map &:min
i=v.index v.max)
s[i]=c}
puts s.chop
end