import java.util.Scanner;
import java.util.Arrays;
public class Ants {
static int length;
static int count;
static int[] position;
static int left = -1;
static int right = -1;
position = new int[100000];
direction
= new String[100000]; Scanner sc
= new Scanner
(System.
in); while (sc.hasNextInt()) {
length = sc.nextInt();
count = sc.nextInt();
int[] indexes = new int[count];
for (int i = 0; i < count; i++) {
position[i] = sc.nextInt();
direction[i] = sc.next();
indexes[i] = i;
}
sort(indexes, position);
//for (int i = 0; i < count; i++) {
// System.out.print(indexes[i] + ", ");
//}
//System.out.println(position[0] + " " + direction[0]);
left = -1;
right = -1;
int max = 0;
for (int i = 0; i < count; i++) {
if(direction[indexes[i]].equals("L")){
if(position[i] >= max){
max = position[i];
left = i;
}
}else{
if((length - position[i]) >= max){
max = length - position[i];
right = i;
}
}
}
int antsR = 0;
int antsL = 0;
if(right != -1){
for (int i = right; i < count; i++) {
//System.out.println("111 " + direction[indexes[i]]);
if(direction[indexes[i]].equals("L")){
antsR++;
}
}
}
if(left != -1){
for (int i = left; i >= 0; i--) {
//System.out.println("222 " + direction[indexes[i]]);
if(direction[indexes[i]].equals("R")){
antsL++;
}
}
}
//System.out.println(antsL + " " + antsR); // ********************
int resultA = -1;
if(right != -1){
if((length - position[right]) == max){
resultA = position[right + antsR];
}
}
int resultB = -1;
if(left != -1){
if((position[left]) == max){
resultB = position[left - antsL];
}
}
if((resultA >= 0) && (resultB == -1)){
System.
out.
println("The last ant will fall down in " + max
+ " seconds - started at " + resultA
+ "."); }
if((resultA == -1) && (resultB >= 0)){
System.
out.
println("The last ant will fall down in " + max
+ " seconds - started at " + resultB
+ "."); }
if((resultA >= 0) && (resultB >= 0)){
if (resultA > resultB) {
int nic = resultA;
resultA = resultB;
resultB = nic;
}
System.
out.
println("The last ant will fall down in " + max
+ " seconds - started at " + resultA
+ " and " + resultB + ".");
}
// System.out.println("The last ant will fall down in " + max + " seconds - started at " + xxx);
}
}
public static void sort(int[] indexes, int[] position) {
for (int i = 0; i < count - 1; i++) {
for (int j = i + 1; j < count; j++) {
if (position[i] > position[j]) {
int a = position[i];
position[i] = position[j];
position[j] = a;
a = indexes[i];
indexes[i] = indexes[j];
indexes[j] = a;
}
}
}
}
}