#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
typedef unsigned long int ulint;
struct ant
{
ant() {}
ant(int start, int pos, int dir) :
start(start), pos(pos), dir(dir) {}
int start;
int pos;
int dir;
int steps;
};
static bool ant_at[2][100100];
static ant ants[100100];
static ulint L;
static ulint A;
int main()
{
char dir;
ulint pos;
while (scanf("%lu %lu", &L, &A) != EOF)
{
memset(ant_at, false, sizeof(ant_at));
for (uint a = 0; a < A; ++a)
{
scanf("%lu %c", &pos, &dir);
ant_at[(dir == 'L') ? 0 : 1][pos] = true;
ants[a] = ant(pos, pos, (dir == 'L') ? -1 : 1);
}
vector<int> fallen;
int steps = 0;
int end_steps;
int A_curr = A;
while (A_curr > 0)
{
fallen.clear();
for (uint a = 0; a < A; ++a)
{
if (ants[a].pos < 0 || ants[a].pos >L)
{
continue;
}
int npos = ants[a].pos + ants[a].dir;
int cpos1 = npos;
int cpos2 = npos + ants[a].dir;
int my_dir = (ants[a].dir == -1) ? 0 : 1;
int opp_dir = (ants[a].dir == -1) ? 1 : 0;
if (cpos1 >= 0 && cpos1 <= L && ant_at[opp_dir][cpos1])
{
ants[a].dir *= -1;
}
else if (cpos2 >= 0 && cpos2 <= L && ant_at[opp_dir][cpos2])
{
ants[a].pos += ants[a].dir;
ants[a].dir *= -1;
if (ants[a].pos < 0 || ants[a].pos > L)
{
fallen.push_back(ants[a].start);
//printf("%d %d\n",steps,ants[a].start);
--A_curr;
}
}
else
{
ants[a].pos += ants[a].dir;
if (ants[a].pos < 0 || ants[a].pos > L)
{
/*
if (fallen == 0)
{
fallen[0] = ants[a].start;
}
else if (fallen == 1)
{
fallen[1] = ants[a].start;
}
else
{
fallen[0] = fallen[1];
fallen[1] = ants[a].start;
}
*/
fallen.push_back(ants[a].start);
//printf("%d %d\n",steps, ants[a].start);
--A_curr;
}
}
if (A_curr == 0)
{
//printf("%d\n", fallen.size());
if (fallen.size() == 1)
{
printf("The last ant will fall down in %d seconds - started at %d.\n", steps, fallen[fallen.size() - 1]);
}
else
{
printf("The last ant will fall down in %d seconds - started at %d and %d.\n", steps, min(fallen[0], fallen[1]), max(fallen[0], fallen[1]));
}
break;
}
}
++steps;
for (uint l = 0; l <= L; ++l)
{
ant_at[0][l] = false;
ant_at[1][l] = false;
}
for (uint a = 0; a < A; ++a)
{
if (ants[a].dir == -1)
{
ant_at[0][ants[a].pos] = true;
}
else
{
ant_at[1][ants[a].pos] = true;
}
}
/*
for (uint a = 0; a < A; ++a)
{
printf("%d ", ants[a].pos);
}
printf("\n");
for (uint a = 0; a < A; ++a)
{
printf("%d ", ants[a].dir);
}
printf("\n");
for (uint l = 0; l < L; ++l)
{
printf("%d ", ant_at[0][l]);
}
printf("\n");
for (uint l = 0; l < L; ++l)
{
printf("%d ", ant_at[1][l]);
}
printf("\n");
//char c;
getchar();
*/
}
}
}