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