#include<stdio.h>
const int maxball = 500000 + 100;
int left[maxball];
int right[maxball];
void link(int b1, int b2)
{
right[b1] = b2;
left[b2] = b1;
}
int main()
{
freopen("input.txt", "r", stdin);
char op[2];
int n, m, x, y;
while(scanf("%d%d", &n, &m) == 2)
{
//ball 0 and n+1 on the leftmost and rightmost
/*array left and right stores the number on the ball
on the lefthand or righthand side respectively
*/
for(int i = 1; i <= n; ++i)
{
left[i] = i - 1;
right[i] = i + 1;
}
for(int i = 0; i < m; ++i)
{
scanf("%s%d%d", op, &x, &y);
link(left[x], right[x]);
if(op[0] == 'A')
{
link(left[y], x);
link(x, y);
}
else
{
link(x, right[y]);
link(y, x);
}
}
int begin;
for(begin = 1; begin <= n && left[begin]; ++begin);
for(int i = begin; i != n+1; i = right[i])
{
printf("%d ", i);
}
putchar('\n');
}
}