1.

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Felix / Dennis
*/
public class DihedralGroups {

public static void main(String... args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
String input = null;
StringTokenizer st;
int points, number;
long r;
boolean m;
String current;
while ((input = br.readLine()) != null) {
if (input.length() < 1) {
continue;
}

points = Integer.parseInt(input.trim());

if (points == 0) {
out.flush();
return;
}

st = new StringTokenizer(br.readLine());

r = 0;
// false: gerade, true: ungerade
m = false;

while (st.hasMoreTokens()) {
current = st.nextToken();
number = Integer.parseInt(current.substring(1));
if (current.charAt(0) == 'm') {
if (number % 2 == 1) {
m = m ? false : true;
}
} else {
r += m ? -number : number;
}
}

r = r % points;
r += points; // falls r negativ ist, positiv machen
r = r % points;

if (m) {
if (r != 0) {
if (r > points / 2) {
out.println("m1 r" + (points - r));
} else {
out.print("r" + r);
out.print(" ");
out.println("m1");
}


}


} else {
if (r != 0) {
if (points - r + 2 < r) {
out.println("m1 r" + (points - r) + " m1");
} else {
out.print("r" + r);
out.println();
}
}
else
out.println();
}

}
}
}