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
		}
		chairs := make([]string, n)
		for i := range chairs {
			chairs[i] = "#"
		}
		sit := func(who string) {
			if who == "A" {
				chairs[getStringIndex(chairs, "#")] = "A" // A国の人は左から見て行って空いている席を見つけ次第座る
				// log.Println(chairs)
			} else if who == "B" {
				f := true
				for i := n-1; i > -1; i-- {
					// B国の人はA国人の隣以外で、右端から空いている椅子に座る
					if chairs[i] == "#" && (i == 0 || chairs[i-1] != "A") && (i == n-1 || chairs[i+1] != "A") {
								chairs[i] = "B"
								f = false
								break
					}
				}
				// A国人の隣しか空いていない場合、我慢して左端から空いている椅子に座る
				if f {
					chairs[getStringIndex(chairs, "#")] = "B"
				}
				// log.Println(chairs)
			} else if who == "C" { // C国人は人の隣に座りたい
				for i := 0; i < n; i++ {
					if chairs[i] != "#" {
						if i + 1 <= n-1 && chairs[i+1] == "#" {
							chairs[i+1] = "C"
							break
						} else if i - 1 >= 0 && chairs[i-1] == "#" {
							chairs[i-1] = "C"
							break
						}
					}
				}
				// log.Println(chairs)
			} else { // who == "D"
				// D国の人は人から離れて座りたい
				// どうしても誰かの隣に座らなければならない場合、その中で一番左側にある椅子に座る
				scores := make([]int, n)
				for i := range scores {
					scores[i] = INF
				}
				for i, v := range chairs {
					if v == "#" {
						scores[i]++
					}
				}
				for i := n-1; i > -1; i-- {
					tmp := 0
					if chairs[i] == "#" {
						tmp++
					} else {
						tmp = 0
					}
					scores[i] = min(scores[i], tmp)
				}
				chairs[getIntIndex(scores, getMax(scores))] = "D"
				// log.Println(chairs)
			}
		}
		scanner.Scan()
		if first := scanner.Text(); first == "A" || first == "D" {
			chairs[0] = first
		} else if first == "B" {
			chairs[len(chairs)-1] = "B"
		} else {
			chairs[n/2] = "C"
		}
		// log.Println(chairs)
		for i := 0; i < m-1; i++ {
			scanner.Scan()
			sit(scanner.Text())
		}
		fmt.Println(strings.Join(chairs, ""))
	}
}

func getStringIndex(chairs []string, who string) int {
	for i, v := range chairs {
		if v == who {
			return i
		}
	}
	return -1
}

func getIntIndex(scores []int, target int) int {
	for i, v := range scores {
		if v == target {
			return i
		}
	}
	return -1
}

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

func getMax(scores []int) int {
	tmp := -1
	for _, v := range scores {
		if tmp < v {
			tmp = v
		}
	}
	return tmp
}

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;
}