Go: package main

import (
	"bufio"
	"os"
	"strings"
	"strconv"
		"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

const INF = 0x7FFFFFFF

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		n, _ := strconv.Atoi(buf[0])
		m, _ := strconv.Atoi(buf[1])
		if n == 0 && m == 0 {
			break
		}
		chair := make([]string, n+1)
		for i := range chair {
			chair[i] = "#"
		}
		chair[n] = "Sentinel"
		for i := 0; i < m; i++ {
			scanner.Scan()
			switch who := scanner.Text(); who {
			case "A": // 左から眺めて行って空いている席があったら即座に座る
				for j := 0; j < n; j++ {
					if chair[j] == "#" {
						chair[j] = "A"
						break
					}
				}
				// log.Println(chair)
				break // 次の人を読み込む
			case "B":
				flag := true
				// 右端からAの隣でない席を探していく
				for j := n-1; j > -1; j-- {
					if chair[j] == "#" && (j == 0 || chair[j-1] != "A") && chair[j+1] != "A" {
						flag = false
						chair[j] = "B"
						break
					}
				}
				// Aの隣しか空いていないので一番左端の空いている席に座る
				if flag {
					for j := 0; j < n; j++ {
						if chair[j] == "#" {
							chair[j] = "B"
							break
						}
					}
				}
				// log.Println(chair)
				break // 次の人を読み込む
			case "C":
				if i == 0 {
					chair[n/2] = "C" // 先客が誰もいないときは真ん中の椅子に座る
				} else {
					for j := 0; j < n; j++ { // 左から舐めて
						if chair[j] != "#" { // その席が空いていなくて
							if chair[j+1] == "#" { // 右隣が空いているなら座る
								chair[j+1] = "C"
								break
							} else if j != 0 && chair[j-1] == "#" { // 右隣が空いていないので左隣に座る
								chair[j-1] = "C"
								break
							}
						}
					}
				}
				// log.Println(chair)
				break // 次の人を読み込む
			case "D":
				distanceTable := make([]int ,n)
				for j := range distanceTable {
					distanceTable[j] = INF
				}
				for j:= 0; j < n; j++ {
					if chair[j] != "#" {
						for k := 0; k < n; k++ {
							distanceTable[k] = min(distanceTable[k], abs(j-k))
						}
					}
				}
				// log.Println("distanceTAble:", distanceTable)
				at := 0
				distance := 0
				for j := 0; j < n; j++ {
					if distance < distanceTable[j] {
						at = j
						distance = distanceTable[j]
					}
				}
				chair[at] = "D"
				// log.Println(chair)
				break // 次の人を読み込む
			}
		}
		for i := 0; i < n; i++ {
			if i == n-1 {
				fmt.Println(chair[i])
			} else {
				fmt.Printf("%s ", chair[i])
			}
		}
	}
}

func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <string>
#include <complex>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <sstream>
#include <numeric>
#include <functional>
#include <bitset>
#include <iomanip>

using namespace std;


#define INF (1<<29)

// math
#define Sq(x) ((x)*(x))

// container utility
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair
#define PB push_back
#define EACH(it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();it++)

// rep
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// typedef
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<VI> VVI;

typedef long long ll;

// useful
#define FST first
#define SND second

#define CK(n,a,b) (a<=n && n<b)

// conversion
template<class T> inline string toStr(T a) { ostringstream oss; oss << a; return oss.str(); }
inline int toInt(string s) { return atoi(s.c_str()); }

// prime
bool isPrime(int a) { for(int i=2; i*i <=a; i++) if(a%i == 0) return false; return true; }

// !!! set SSIEVVE_MAX_L number !!!
#define SSIEVE_MAX_L (1000001)
#define SSIEVE_MAX_SQRT_B ((int)sqrt(INT_MAX)+1)
 
bool is_prime[SSIEVE_MAX_L];
vector<bool> is_prime_small(SSIEVE_MAX_SQRT_B);
 
void segment_sieve(ll a, ll b) {
   
  for(int i=0; (ll)i*i < b; i++) is_prime_small[i] = true;
  for(int i=0; i < b-a; i++) is_prime[i] = true;
   
  if(a == 1) {
    is_prime[0] = false;
  }
   
  for(int i=2; (ll)i*i<b; i++) {
    if(is_prime_small[i]) {
      for(int j=2*i; (ll)j*j<b; j+=i) is_prime_small[j] = false;
      for(ll j = max(2LL, (a+i-1)/i)*i; j<b; j+=i) is_prime[j-a] = false;
    }
  }
}

int const dx[] = {-1,0,1,0,-1,1,1,-1};
int const dy[] = {0,-1,0,1,-1,-1,1,1};

//////////////////////////////////////////////////////////////

void Dump(vector<char> &chair) {
  cout << "--------------" << endl;
  EACH(i, chair) { cout << *i; }
  cout << endl;
  cout << "--------------" << endl;
}

void A(vector<char> &chair) {
  EACH(i, chair) {
    if(*i == '#') {
      *i = 'A';
      break;
    }
  }
}

void B(vector<char> &chair) {
  
  for(int i=chair.size()-1; i>0; i--) {
    if( chair[i] == '#' && chair[i-1] != 'A' ) {
      if(i != chair.size()-1 && chair[i+1] == 'A') continue;
      chair[i] = 'B';
      return;
    }
  }

  EACH(i, chair) {
    if(*i == '#') {
      *i = 'B';
      return;
    }
  }
  
}

void C(vector<char> &chair) {
  
  bool check = 1;
  EACH(i, chair) check &= *i == '#';
  if(check) {
    int size = chair.size();
    if(size%2) {
      chair[(size-1)/2] = 'C';
    }
    else {
      chair[size/2] = 'C';
    }
    return;
  }
  
  for(int i=0; i<chair.size()-1; i++) {
    if( chair[i]!='#' ) {
      if( chair[i+1] == '#' ) {
	chair[i+1] = 'C';
	return;
      }
      else if( i && chair[i-1] == '#' ) {
	chair[i-1] = 'C';
	return;
      }
    }
  }
  
}

int DCheck(vector<char> &chair, int pos) {
  
  bool noperson = true;
  int dist = 1;
  for(int i=pos-1; i>=0; i--) {
    if(chair[i] != '#') { noperson = false; break; }
    dist++;
  }
  if(noperson) { dist = pos+1; }
  
  noperson = true;
  int res = dist;
  dist = 1;
  for(int i=pos+1; i<chair.size(); i++) {
    if(chair[i] != '#') { noperson = false; break; }
    dist++;
  }
  if(noperson) { dist = pos+1; }
  
  return min(res, dist);
}

void D(vector<char> &chair) {
  
  int const size = chair.size();
  VI arr(size);
  
  int dist = 0;
  for(int i = size-1; i>=0; i--){
    if( chair[i]=='#' ) { dist ++; }
    else { dist = 0; }
    arr[i] = dist;
  }
  
  dist = 0;
  int res = 0;
  int pos = 0;
  for(int i=0; i<size; i++){
    if( chair[i]=='#' ) { dist ++; }
    else { dist = 0; }
    if( !i || i == size - 1 ){ arr[i] = max(arr[i], dist); }
    else { arr[i] = min(arr[i], dist); }
    if(res < arr[i]){
      res = arr[i];
      pos = i;
    }
  }
  chair[pos] = 'D';
  /*
  bool check = 1;
  EACH(i, chair) check &= *i == '#';
  if(check) {
    chair[0] = 'D';
    return;
  }

  int pos, dist = -INF;
  int const size = chair.size();
  for(int i=0; i<size; i++) {
    // left yusen
    if(chair[i] == '#') {
      int tdist = DCheck(chair, i);
      //      cout << i << ' ' << tdist;
      if(tdist > dist) {
	dist = tdist;
	pos = i;
      }
      //      cout << ' ' << pos << endl;
    }
  }
  
  chair[pos] = 'D';
		*/
}

void sit(char ch, vector<char> &chair) {
  switch(ch) {
  case 'A': A(chair); break;
  case 'B': B(chair); break;
  case 'C': C(chair); break;
  case 'D': D(chair); break;
  }
}

int main() {
  
  int N, M;

  while(cin >> N >> M && (N|M)) {
    vector<char> chair(N);
    
    fill(ALL(chair), '#');

    for(int i=0; i<M; i++) {
      char ch;
      cin >> ch;
      sit(ch, chair);
      //Dump(chair);
    }
    
    EACH(i, chair) {
      cout << *i;
    }
    cout << endl;
  }
  
  return 0;
}